Exemple #1
0
        public override Task OnConnected()
        {
            var name = PXAccess.GetUserName();

            Groups.Add(Context.ConnectionId, name);
            return(base.OnConnected());
        }
Exemple #2
0
        public bool CanPostToClosedPeriod()
        {
            GLSetup setup = PXSelect <GLSetup> .Select(Graph);

            return(setup.RestrictAccessToClosedPeriods != true ||
                   !string.IsNullOrEmpty(PredefinedRoles.FinancialSupervisor) &&
                   System.Web.Security.Roles.IsUserInRole(PXAccess.GetUserName(), PredefinedRoles.FinancialSupervisor));
        }
Exemple #3
0
    /// <summary>
    /// Gets the braches enumerator.
    /// </summary>
    private IEnumerable <PXAccess.BranchCollection.Info> GetBranches()
    {
        var currentUser = PXAccess.GetUserName();

        foreach (PXAccess.BranchCollection.Info item in PXAccess.GetBranches(currentUser, true))
        {
            yield return(item);
        }
    }
Exemple #4
0
 protected override void Dispose(bool disposing)
 {
     if (HttpContext.Current != null && HttpContext.Current.Session != null)
     {
         PXLogin.LogoutUser(PXAccess.GetUserName(), HttpContext.Current.Session.SessionID);
     }
     FormsAuthenticationModule.SignOut();
     base.Dispose(disposing);
 }
Exemple #5
0
        public void SaveCurrentContextValues(string companyName, object parentLongOperationKey)
        {
            this._parentFinished         = false;
            this._parentLongOperationKey = parentLongOperationKey;

            this.CompanyName           = companyName;
            this.UserNameForLoginScope = PXDatabase.Companies.Length > 0 ? PXAccess.GetUserName() + "@" + this.CompanyName : PXAccess.GetUserName();

            this.BranchID     = PXContext.GetBranchID();
            this.BusinessDate = PXContext.GetBusinessDate();
            this.ScreenID     = PXContext.GetScreenID();
        }
 protected virtual void UserPreferences_RowPersisted(PXCache sender, PXRowPersistedEventArgs e)
 {
     if (e.TranStatus == PXTranStatus.Completed)
     {
         if (System.Web.HttpContext.Current != null &&
             String.Equals(this.UserProfile.Current.Username, PXAccess.GetUserName()))
         {
             // do not throw an exception to prevent breaking of the event-handling chain
             Redirector.Refresh(System.Web.HttpContext.Current);
         }
     }
 }
Exemple #7
0
 protected void Logout(object sender, EventArgs e)
 {
     try
     {
         PXLogin.LogoutUser(PXAccess.GetUserName(), Session.SessionID);
         PXContext.Session.SetString("UserLogin", string.Empty);
         Session.Abandon();
         PX.Data.Auth.ExternalAuthHelper.SignOut(Context, "~/Frames/Outlook/FirstRun.html");
         PXDatabase.Delete <PX.SM.UserIdentity>(
             new PXDataFieldRestrict <PX.SM.UserIdentity.providerName>(PXDbType.VarChar, "ExchangeIdentityToken"),
             new PXDataFieldRestrict <PX.SM.UserIdentity.userID>(PXDbType.UniqueIdentifier, PXAccess.GetUserID())
             );
     }
     finally
     {
         PX.Data.Redirector.Redirect(System.Web.HttpContext.Current, "~/Frames/Outlook/FirstRun.html");
     }
 }
Exemple #8
0
        protected virtual void SelectedFieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            if ((bool)e.NewValue == true ||
                PXAccess.GetUserName() != ((Users)_Graph.Caches[typeof(Users)].Current).Username)
            {
                return;
            }

            EPLoginTypeAllowsRole role = (EPLoginTypeAllowsRole)e.Row;

            if (Access.WillSelfLock(sender, role.Rolename))
            {
                if (Ask(Messages.Warning, Messages.UserLockingHimselfOut,
                        MessageButtons.YesNo, MessageIcon.Warning) != WebDialogResult.Yes)
                {
                    e.NewValue = true;
                    e.Cancel   = true;
                }
            }
        }