Beispiel #1
0
        public IHttpActionResult SaveMembers(UIAccounts groupAccounts)
        {
            string        mRetVal       = "false";
            Logger        mLog          = Logger.Instance();
            MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditGroups", true)), AccountUtility.CurrentProfile());

            if (!mSecurityInfo.MayEdit)
            {
                Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to add");
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            if (HttpContext.Current.Items["EditId"] == null || HttpContext.Current.Items["EditId"].ToString().ToLowerInvariant() != groupAccounts.SeqId.ToString().ToLowerInvariant())
            {
                Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!");
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            MAccountProfile     accountProfile      = AccountUtility.CurrentProfile();
            MClientChoicesState mClientChoicesState = ClientChoicesUtility.GetClientChoicesState(accountProfile.Account);
            MGroupRoles         mProfile            = new MGroupRoles();

            mProfile.SecurityEntityId = SecurityEntityUtility.CurrentProfile().Id;
            mProfile.GroupSeqId       = groupAccounts.SeqId;
            mProfile.Roles            = String.Join(",", groupAccounts.Accounts);
            mProfile.AddedUpdatedBy   = accountProfile.Id;
            GroupUtility.UpdateGroupRoles(mProfile);
            return(Ok(mRetVal));
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MAccountProfile mAccountProfile = AccountUtility.CurrentProfile();
            bool            flag            = mAccountProfile.Status == 4;

            if (flag)
            {
                this.trForceChange.Visible  = true;
                this.trNormalChange.Visible = false;
                this.trOldPassword.Visible  = false;
                this.NewPassword.Focus();
            }
            else
            {
                this.trForceChange.Visible  = false;
                this.trNormalChange.Visible = true;
                this.trOldPassword.Visible  = true;
                this.OldPassword.Focus();
            }
            Exception mException = GWWebHelper.ExceptionError;

            if (mException != null)
            {
                clientMessage.Style.Add("display", "");
                clientMessage.InnerHtml    = mException.Message.ToString();
                GWWebHelper.ExceptionError = null;
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string   rowFilter  = "FUNCTION_TYPE_SEQ_ID <> 2 AND FUNCTION_TYPE_SEQ_ID <> 3";
            DataView myDataView = AccountUtility.GetMenu(AccountUtility.CurrentProfile().Account, MenuType.Hierarchical).DefaultView;

            myDataView.Sort             = "Title asc";
            myDataView.RowFilter        = rowFilter;
            dropFavorite.DataSource     = myDataView;
            dropFavorite.DataValueField = "url";
            dropFavorite.DataTextField  = "Title";
            dropFavorite.DataBind();
            txtPreferedRecordsPerPage.Text = ClientChoicesState[MClientChoices.RecordsPerPage].ToString();
            NameValuePairUtility.SetDropSelection(dropFavorite, ClientChoicesState[MClientChoices.Action].ToString());
            int X = 0;

            for (X = 1; X <= 5; X++)
            {
                HtmlInputRadioButton button = (HtmlInputRadioButton)this.FindControl("Radio" + X);
                if (button.Value.Substring(0, ClientChoicesState[MClientChoices.ColorScheme].Length).ToLower(new CultureInfo("en-US", false)) == ClientChoicesState[MClientChoices.ColorScheme].ToLower(new CultureInfo("en-US", false)))
                {
                    button.Checked = true;
                    break; // TODO: might not be correct. Was : Exit For
                }
            }
        }
Beispiel #4
0
 /// <summary>
 /// Page_s the init.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
 protected void Page_Init(Object sender, EventArgs e)
 {
     m_SecurityInfo   = new MSecurityInfo(FunctionUtility.CurrentProfile(), AccountUtility.CurrentProfile());
     m_ShowDeleteLink = m_SecurityInfo.MayDelete;
     if (!m_SecurityInfo.MayView)
     {
         this.searchResults.Columns.RemoveAt(0);
     }
 }
Beispiel #5
0
        protected void Page_Init(object sender, EventArgs e)
        {
            string mAction = GWWebHelper.GetQueryValue(Request, "action");

            if (!String.IsNullOrEmpty(mAction))
            {
                m_SecurityInfo = new MSecurityInfo(FunctionUtility.CurrentProfile(), AccountUtility.CurrentProfile());
            }
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MAccountProfile mAccountProfile = AccountUtility.CurrentProfile();
            int             mSecurityId     = int.Parse(ClientChoicesState[MClientChoices.SecurityEntityId]);

            dropSecurityEntities.DataSource     = SecurityEntityUtility.GetValidSecurityEntities(mAccountProfile.Account, mSecurityId, mAccountProfile.IsSystemAdmin);
            dropSecurityEntities.DataValueField = "SE_SEQ_ID";
            dropSecurityEntities.DataTextField  = "NAME";
            dropSecurityEntities.DataBind();
            NameValuePairUtility.SetDropSelection(dropSecurityEntities, mSecurityId.ToString());
        }
Beispiel #7
0
        public IHttpActionResult Delete([FromUri] int functionSeqID)
        {
            if (functionSeqID <= 0)
            {
                throw new ArgumentNullException("functionSeqID", " must be a positive number!");
            }
            string mRetVal = "False";
            Logger mLog    = Logger.Instance();

            if (HttpContext.Current.Items["EditId"] != null)
            {
                int mEditId = int.Parse(HttpContext.Current.Items["EditId"].ToString());
                if (mEditId == functionSeqID)
                {
                    MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditFunction", true)), AccountUtility.CurrentProfile());
                    if (mSecurityInfo != null)
                    {
                        if (mSecurityInfo.MayDelete)
                        {
                            try
                            {
                                FunctionUtility.Delete(functionSeqID);
                                mRetVal = "True";
                            }
                            catch (Exception ex)
                            {
                                mLog.Error(ex);
                                throw;
                            }
                        }
                        else
                        {
                            Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to delete");
                            mLog.Error(mError);
                            return(this.InternalServerError(mError));
                        }
                    }
                    else
                    {
                        Exception mError = new Exception("Security Info is not in context nothing has been saved!!!!");
                        mLog.Error(mError);
                        return(this.InternalServerError(mError));
                    }
                }
                else
                {
                    Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!");
                    mLog.Error(mError);
                    return(this.InternalServerError(mError));
                }
            }
            return(Ok(mRetVal));
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string mAction = GWWebHelper.GetQueryValue(Request, "action");

            if (!String.IsNullOrEmpty(mAction))
            {
                MAccountProfile  mAccountProfile  = AccountUtility.CurrentProfile();
                MFunctionProfile mFunctionProfile = FunctionUtility.GetProfile(mAction);
                MSecurityInfo    mSecurityInfo    = new MSecurityInfo(mFunctionProfile, mAccountProfile);
                SearchControl.ShowAddLink = mSecurityInfo.MayAdd;
            }
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int             mSecurityEntityID = SecurityEntityUtility.DefaultProfile().Id;
            MAccountProfile mAccountProfile   = AccountUtility.CurrentProfile();

            if (mAccountProfile != null)
            {
                mSecurityEntityID = int.Parse(ClientChoicesUtility.GetClientChoicesState(AccountUtility.CurrentProfile().Account)[MClientChoices.SecurityEntityId].ToString());
            }
            MSecurityEntityProfile mSecurityEntityProfile = SecurityEntityUtility.GetProfile(mSecurityEntityID);

            formStyles.Attributes["href"] = GWWebHelper.RootSite + "/Content/FormStyles/" + mSecurityEntityProfile.Style + ".css";
        }
Beispiel #10
0
        public IHttpActionResult Save(MUIRoleProfile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("uiProfile", "uiProfile cannot be a null reference (Nothing in Visual Basic)!");
            }
            string        mRetVal        = "false";
            MRoleProfile  mProfileToSave = new MRoleProfile();
            MSecurityInfo mSecurityInfo  = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditRoles", true)), AccountUtility.CurrentProfile());
            Logger        mLog           = Logger.Instance();

            if (HttpContext.Current.Items["EditId"] != null)
            {
                if (profile.Id == -1)
                {
                    if (!mSecurityInfo.MayAdd)
                    {
                        Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to add");
                        mLog.Error(mError);
                        return(this.InternalServerError(mError));
                    }
                    mProfileToSave.AddedBy   = AccountUtility.CurrentProfile().Id;
                    mProfileToSave.AddedDate = DateTime.Now;
                }
                else
                {
                    if (!mSecurityInfo.MayAdd)
                    {
                        Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to edit");
                        mLog.Error(mError);
                        return(this.InternalServerError(mError));
                    }
                    if (profile.IsSystem)
                    {
                        mProfileToSave.IsSystem = true;
                    }
                    if (profile.IsSystemOnly)
                    {
                        mProfileToSave.IsSystemOnly = true;
                    }
                    mProfileToSave = RoleUtility.GetProfile(profile.Id);

                    mProfileToSave.UpdatedBy   = AccountUtility.CurrentProfile().Id;
                    mProfileToSave.UpdatedDate = DateTime.Now;
                }
            }
            mProfileToSave = populateProfile(profile);
            RoleUtility.Save(mProfileToSave);
            return(Ok(mRetVal));
        }
Beispiel #11
0
        protected void Page_Init(Object sender, EventArgs e)
        {
            string mAction = "Search_Functions";

            if (!String.IsNullOrEmpty(mAction))
            {
                MFunctionProfile mFunctionProfile = FunctionUtility.GetProfile(mAction);
                m_SecurityInfo = new MSecurityInfo(mFunctionProfile, AccountUtility.CurrentProfile());
                if (!m_SecurityInfo.MayEdit)
                {
                    searchResults.Columns.RemoveAt(0);
                }
                m_ShowDeleteLink = m_SecurityInfo.MayDelete;
            }
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SearchControl.ShowAddLink = false;
            MDirectoryProfile mDirectoryProfile = DirectoryUtility.GetProfile(FunctionUtility.CurrentProfile().Id);
            String            mLinks            = FileUtility.GetDirectoryLinks("/", mDirectoryProfile.FunctionSeqId);

            directorySelector.InnerHtml = mLinks;
            MFunctionProfile mFunctionProfile = FunctionUtility.CurrentProfile();
            MAccountProfile  mAccountProfile  = AccountUtility.CurrentProfile();
            MSecurityInfo    mSI = new MSecurityInfo(mFunctionProfile, mAccountProfile);

            UploadControl.Visible       = mSI.MayAdd;
            tdNewDirectory.Visible      = mSI.MayAdd;
            SearchControl.ShowDeleteAll = mSI.MayDelete;
            SearchControl.ShowSelect    = mSI.MayDelete;
        }
Beispiel #13
0
        public MUIAccountChoices GetPreferences()
        {
            MAccountProfile     mAccountProfile     = AccountUtility.CurrentProfile();
            MClientChoicesState mClientChoicesState = null;
            MUIAccountChoices   mRetVal             = null;

            if (mAccountProfile != null)
            {
                mClientChoicesState      = ClientChoicesUtility.GetClientChoicesState(mAccountProfile.Account.ToString(CultureInfo.InvariantCulture));
                mRetVal                  = new MUIAccountChoices(mClientChoicesState);
                mRetVal.Environment      = GWWebHelper.DisplayEnvironment;
                mRetVal.Version          = GWWebHelper.Version;
                mRetVal.FrameWorkVersion = GWWebHelper.FrameworkVersion;
            }
            return(mRetVal);
        }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String           mAction          = ClientChoicesState[MClientChoices.Action];
            MFunctionProfile mFunctionProfile = FunctionUtility.GetProfile(mAction);
            MAccountProfile  mAccountProfile  = AccountUtility.CurrentProfile();
            MSecurityInfo    mSecurityInfo    = new MSecurityInfo(mFunctionProfile, mAccountProfile);

            if (mSecurityInfo.MayView)
            {
                String mScript = "<script type='text/javascript' language='javascript'>window.location.hash = '?Action=" + mAction + "'</script>";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", mScript);
            }
            else
            {
                Response.Write("Your favorite is not available.  Please ensure that you have chosen the correct " + ConfigSettings.SecurityEntityTranslation);
            }
        }
Beispiel #15
0
        public bool MoveMenu(int functionSeqId, string direction)
        {
            bool             mRetVal         = false;
            MFunctionProfile mProfile        = FunctionUtility.GetProfile(functionSeqId);
            MAccountProfile  mAccountProfile = AccountUtility.CurrentProfile();
            DirectionType    mDirection;

            Enum.TryParse(direction, out mDirection);
            if (direction == "up")
            {
                FunctionUtility.Move(mProfile, DirectionType.Up, mAccountProfile.Id, DateTime.Now);
            }
            else
            {
                FunctionUtility.Move(mProfile, DirectionType.Down, mAccountProfile.Id, DateTime.Now);
            }
            return(mRetVal);
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Exception mException = GWWebHelper.ExceptionError;

            if (mException != null)
            {
                clientMessage.Style.Add("display", "");
                clientMessage.InnerHtml    = mException.Message.ToString();
                GWWebHelper.ExceptionError = null;
            }
            else
            {
                if (AccountUtility.CurrentProfile().Account.ToString().ToUpper(CultureInfo.InvariantCulture) != "ANONYMOUS")
                {
                    clientMessage.Style.Add("display", "");
                    clientMessage.InnerHtml = "You are currently logged on as " + AccountUtility.CurrentProfile().Account.ToString();
                }
            }
        }
Beispiel #17
0
        public IHttpActionResult DeleteNameValuePairDetail(UINVPDetailProfile uiProfile)
        {
            string          mRetVal          = false.ToString();
            String          mAction          = GWWebHelper.GetQueryValue(HttpContext.Current.Request, "Action");
            int             mEditId          = int.Parse(HttpContext.Current.Items["EditId"].ToString());
            MAccountProfile mUpdatingAccount = AccountUtility.CurrentProfile();
            MSecurityInfo   mSecurityInfo    = new MSecurityInfo(FunctionUtility.GetProfile(mAction), mUpdatingAccount);

            Logger mLog = Logger.Instance();

            if (mEditId != uiProfile.NVP_SEQ_DET_ID)
            {
                Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!");
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            if (!mSecurityInfo.MayDelete)
            {
                Exception mError = new Exception("The account (" + mUpdatingAccount.Account + ") being used does not have the correct permissions to delete");
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            try
            {
                MNameValuePairDetail mProfile = new MNameValuePairDetail();
                mProfile.NameValuePairSeqId = uiProfile.NVP_SEQ_ID;
                mProfile.Id          = uiProfile.NVP_SEQ_DET_ID;
                mProfile.UpdatedBy   = mUpdatingAccount.Id;
                mProfile.UpdatedDate = DateTime.Now;
                mProfile.SortOrder   = uiProfile.SortOrder;
                mProfile.Text        = uiProfile.Text;
                mProfile.Value       = uiProfile.Value;
                mProfile.Status      = uiProfile.Status;
                NameValuePairUtility.DeleteDetail(mProfile);
            }
            catch (Exception ex)
            {
                mLog.Error(ex);
                throw;
            }
            return(this.Ok(mRetVal));
        }
Beispiel #18
0
        private MSecurityEntityProfile populateSecurityEntity(MUISecurityEntityProfile uiProfile)
        {
            MSecurityEntityProfile mSecurityEntityProfile = new MSecurityEntityProfile();

            mSecurityEntityProfile.UpdatedBy                   = AccountUtility.CurrentProfile().Id;
            mSecurityEntityProfile.UpdatedDate                 = DateTime.Now;
            mSecurityEntityProfile.ConnectionString            = uiProfile.ConnectionString;
            mSecurityEntityProfile.DataAccessLayer             = uiProfile.DAL;
            mSecurityEntityProfile.DataAccessLayerAssemblyName = uiProfile.DALAssemblyName;
            mSecurityEntityProfile.DataAccessLayerNamespace    = uiProfile.DALNamespace;
            mSecurityEntityProfile.Description                 = uiProfile.Description;
            mSecurityEntityProfile.EncryptionType              = (EncryptionType)uiProfile.EncryptionType;
            mSecurityEntityProfile.Name        = uiProfile.Name;
            mSecurityEntityProfile.ParentSeqId = uiProfile.ParentSeqId;
            mSecurityEntityProfile.Skin        = uiProfile.Skin;
            mSecurityEntityProfile.StatusSeqId = uiProfile.StatusSeqId;
            mSecurityEntityProfile.Style       = uiProfile.Style;
            mSecurityEntityProfile.Url         = uiProfile.Url;
            return(mSecurityEntityProfile);
        }
Beispiel #19
0
        public IHttpActionResult Delete([FromUri] int groupSeqId)
        {
            string        mRetVal       = "false";
            MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditGroups", true)), AccountUtility.CurrentProfile());

            if (!mSecurityInfo.MayDelete)
            {
                Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to delete");
                Logger    mLog   = Logger.Instance();
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            else
            {
                if (HttpContext.Current.Items["EditId"] != null)
                {
                    int mEditId = int.Parse(HttpContext.Current.Items["EditId"].ToString());
                    if (mEditId == groupSeqId)
                    {
                        MGroupProfile mProfile = GroupUtility.GetProfile(groupSeqId);
                        GroupUtility.Delete(mProfile);
                    }
                    else
                    {
                        Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!");
                        Logger    mLog   = Logger.Instance();
                        mLog.Error(mError);
                        return(this.InternalServerError(mError));
                    }
                }
                else
                {
                    Exception mError = new Exception("The identifier unknown and nothing has been saved!!!!");
                    Logger    mLog   = Logger.Instance();
                    mLog.Error(mError);
                    return(this.InternalServerError(mError));
                }
            }

            return(Ok(mRetVal));
        }
Beispiel #20
0
        private void populatePage()
        {
            populateGeneral();
            populateRoles();
            populateGroups();
            if (String.IsNullOrEmpty(hdnCanSaveStatus.Value.ToString()))
            {
                hdnCanSaveStatus.Value = true.ToString();
            }

            MSecurityInfo mGroupTabSecurity = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_View_Account_Group_Tab", true)), AccountUtility.CurrentProfile());
            MSecurityInfo mRoleTabSecurity  = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_View_Account_Role_Tab", true)), AccountUtility.CurrentProfile());

            if (String.IsNullOrEmpty(hdnCanSaveRoles.Value.ToString()))
            {
                hdnCanSaveRoles.Value = mRoleTabSecurity.MayView.ToString();
                tabsRoles.Visible     = mRoleTabSecurity.MayView;
                rolesTab.Visible      = mRoleTabSecurity.MayView;
            }
            else
            {
                hdnCanSaveRoles.Value = "False";
                tabsRoles.Visible     = false;
                rolesTab.Visible      = false;
            }
            if (String.IsNullOrEmpty(hdnCanSaveGroups.Value.ToString()))
            {
                hdnCanSaveGroups.Value = mGroupTabSecurity.MayView.ToString();
                tabsGroups.Visible     = mGroupTabSecurity.MayView;
                groupsTab.Visible      = mGroupTabSecurity.MayView;
            }
            else
            {
                hdnCanSaveGroups.Value = "False";
                tabsGroups.Visible     = false;
                groupsTab.Visible      = false;
            }
            trSysAdmin.Visible = AccountUtility.CurrentProfile().IsSystemAdmin;
        }
Beispiel #21
0
 private MAccountProfile populateAccountProfile(UIAccountProfile uiProfile, MAccountProfile accountProfile)
 {
     if (accountProfile == null)
     {
         accountProfile = new MAccountProfile();
     }
     accountProfile.Account             = uiProfile.Account;
     accountProfile.Email               = uiProfile.EMail;
     accountProfile.EnableNotifications = uiProfile.EnableNotifications;
     accountProfile.FirstName           = uiProfile.FirstName;
     if (AccountUtility.CurrentProfile().IsSystemAdmin)
     {
         accountProfile.IsSystemAdmin = uiProfile.IsSystemAdmin;
     }
     accountProfile.LastName      = uiProfile.LastName;
     accountProfile.Location      = uiProfile.Location;
     accountProfile.MiddleName    = uiProfile.MiddleName;
     accountProfile.Name          = uiProfile.Account;
     accountProfile.PreferredName = uiProfile.PreferredName;
     accountProfile.Status        = uiProfile.Status;
     accountProfile.TimeZone      = uiProfile.TimeZone;
     return(accountProfile);
 }
Beispiel #22
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            m_SecurityInfo    = new MSecurityInfo(FunctionUtility.CurrentProfile(), AccountUtility.CurrentProfile());
            noResults.Visible = false;
            searchResults.HeaderStyle.ForeColor         = ColorTranslator.FromHtml(ClientChoicesState[MClientChoices.HeaderForeColor]);
            searchResults.HeaderStyle.BackColor         = ColorTranslator.FromHtml(ClientChoicesState[MClientChoices.HeadColor]);
            searchResults.AlternatingRowStyle.BackColor = ColorTranslator.FromHtml(ClientChoicesState[MClientChoices.AlternatingRowBackColor]);
            searchResults.RowStyle.BackColor            = ColorTranslator.FromHtml(ClientChoicesState[MClientChoices.RowBackColor]);
            if (!String.IsNullOrEmpty(GWWebHelper.GetQueryValue(Request, "Columns")))
            {
                MSearchCriteria mSearchCriteria = new MSearchCriteria();
                mSearchCriteria.Columns          = GWWebHelper.GetQueryValue(Request, "Columns");
                mSearchCriteria.OrderByColumn    = Server.UrlDecode(GWWebHelper.GetQueryValue(Request, "OrderByColumn"));
                mSearchCriteria.OrderByDirection = GWWebHelper.GetQueryValue(Request, "OrderByDirection");
                int mTryParse = 0;
                if (int.TryParse(GWWebHelper.GetQueryValue(Request, "PageSize"), out mTryParse))
                {
                    mSearchCriteria.PageSize = int.Parse(GWWebHelper.GetQueryValue(Request, "PageSize"));
                }
                else
                {
                    mSearchCriteria.PageSize = 10;
                }

                if (int.TryParse(GWWebHelper.GetQueryValue(Request, "SelectedPage"), out mTryParse))
                {
                    mSearchCriteria.SelectedPage = int.Parse(GWWebHelper.GetQueryValue(Request, "SelectedPage"));
                }
                else
                {
                    mSearchCriteria.SelectedPage = 1;
                }
                mSearchCriteria.WhereClause = Server.UrlDecode(GWWebHelper.GetQueryValue(Request, "WhereClause"));
                mSearchCriteria.WhereClause = mSearchCriteria.WhereClause.Replace("\"", String.Empty);
                bindData(mSearchCriteria);
            }
        }
Beispiel #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MAccountProfile updatingAccount = null;
            MGroupProfile   mGroupProfile   = GroupUtility.GetProfile(int.Parse(HttpContext.Current.Request["GroupSeqId"]));

            txtEditID.Text = mGroupProfile.Id.ToString();
            litGroup.Text  = mGroupProfile.Name;
            HttpContext.Current.Session.Add("EditId", mGroupProfile.Id);
            updatingAccount = AccountUtility.CurrentProfile();

            DataView myDataView = RoleUtility.GetAllRolesBySecurityEntity(int.Parse(ClientChoicesState[MClientChoices.SecurityEntityId].ToString())).DefaultView;

            if (!updatingAccount.IsSystemAdmin)
            {
                String rowFilter = "IS_SYSTEM <> 1 AND IS_SYSTEM_ONLY <> 1";
                myDataView.RowFilter = rowFilter;
            }
            try
            {
                MGroupProfile myGroupProfile = new MGroupProfile();
                myGroupProfile = GroupUtility.GetProfile(int.Parse(txtEditID.Text.ToString()));
                litGroup.Text  = myGroupProfile.Name;
                MGroupRoles mProfile = new MGroupRoles();
                mProfile.SecurityEntityId = int.Parse(ClientChoicesState[MClientChoices.SecurityEntityId].ToString());
                mProfile.GroupSeqId       = int.Parse(txtEditID.Text.ToString());
                ctlMembers.SelectedItems  = GroupUtility.GetSelectedRoles(mProfile);
            }
            catch (Exception ex)
            {
                Logger log = Logger.Instance();
                log.Debug(ex);
            }
            ctlMembers.DataSource = myDataView;
            ctlMembers.DataField  = "Name";
            ctlMembers.DataBind();
        }
Beispiel #24
0
        public IHttpActionResult SaveMembers(UIAccounts roleAccounts)
        {
            string        mRetVal       = "false";
            Logger        mLog          = Logger.Instance();
            MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditRoles", true)), AccountUtility.CurrentProfile());

            if (!mSecurityInfo.MayEdit)
            {
                Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to add");
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            if (HttpContext.Current.Items["EditId"] == null)
            {
                Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!");
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            MAccountProfile     accountProfile      = AccountUtility.CurrentProfile();
            MClientChoicesState mClientChoicesState = ClientChoicesUtility.GetClientChoicesState(accountProfile.Account);
            bool success = RoleUtility.UpdateAllAccountsForRole(roleAccounts.SeqId, int.Parse(mClientChoicesState[MClientChoices.SecurityEntityId]), roleAccounts.Accounts, accountProfile.Id);

            return(Ok(mRetVal));
        }
Beispiel #25
0
 protected void Page_Load(object sender, EventArgs e)
 {
     btnSave.Visible = false;
     m_Action        = GWWebHelper.GetQueryValue(Request, "Action");
     if (!String.IsNullOrEmpty(Request.QueryString["AccountSeqID"]))
     {
         int mAccountSeqID = int.Parse(Request.QueryString["AccountSeqID"].ToString());
         if (mAccountSeqID != -1)
         {
             m_Profile = AccountUtility.GetProfile(mAccountSeqID);
         }
         else
         {
             m_Profile = new MAccountProfile();
         }
     }
     else
     {
         m_Profile              = AccountUtility.CurrentProfile();
         btnSave.Visible        = true;
         hdnCanSaveRoles.Value  = false.ToString();
         hdnCanSaveGroups.Value = false.ToString();
         hdnCanSaveStatus.Value = false.ToString();
         tdStatus.Style.Add("display", "none");
         dropStatus.Style.Add("display", "none");
         if (m_Action.ToUpper(CultureInfo.InvariantCulture).IndexOf("REGISTER") > -1)
         {
             m_Profile                = new MAccountProfile();
             trAccount.Visible        = false;
             tabsDerivedRoles.Visible = false;
             derivedRolesTab.Visible  = false;
         }
     }
     HttpContext.Current.Session.Add("EditId", m_Profile.Id);
     populatePage();
 }
Beispiel #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MRoleProfile  myProfile           = new MRoleProfile();
            MSecurityInfo accountSecurityInfo = new MSecurityInfo(FunctionUtility.CurrentProfile(), AccountUtility.CurrentProfile());

            txtEditID.Text = Request.QueryString[GWWebHelper.RoleDataKeyField].ToString();
            //HttpContext.Current.Session.Remove(AppConstants.ROLE_DATA_KEY_FIELD);
            myProfile.Id = int.Parse(txtEditID.Text);
            HttpContext.Current.Session.Add("EditId", myProfile.Id);
            myProfile    = RoleUtility.GetProfile(myProfile.Id);
            litRole.Text = myProfile.Name;
            myProfile.SecurityEntityId = int.Parse(ClientChoicesState[MClientChoices.SecurityEntityId].ToString());
            ctlMembers.DataSource      = RoleUtility.GetAccountsNotInRole(myProfile).ToArray(Type.GetType("System.String"));
            ctlMembers.SelectedItems   = (string[])RoleUtility.GetAccountsInRole(myProfile).ToArray(Type.GetType("System.String"));
            ctlMembers.DataBind();
        }
Beispiel #27
0
        public IHttpActionResult Save(MUISecurityEntityProfile uiProfile)
        {
            if (uiProfile == null)
            {
                new ArgumentNullException("uiProfile", "uiProfile cannot be a null reference (Nothing in Visual Basic)!");
            }
            bool          mRetVal       = false;
            Logger        mLog          = Logger.Instance();
            var           session       = SessionStateUtility.GetHttpSessionStateFromContext(HttpContext.Current);
            MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditSecurityEntity", true)), AccountUtility.CurrentProfile());

            if (mSecurityInfo != null)
            {
                if (HttpContext.Current.Session["EditId"] != null)
                {
                    int mEditId = int.Parse(HttpContext.Current.Items["EditId"].ToString());
                    if (mEditId == int.Parse(uiProfile.Id))
                    {
                        if (mEditId != -1)
                        {
                            if (mSecurityInfo.MayEdit)
                            {
                                MSecurityEntityProfile mSecurityEntityProfile = SecurityEntityUtility.GetProfile(mEditId);
                                mSecurityEntityProfile    = populateSecurityEntity(uiProfile);
                                mSecurityEntityProfile.Id = int.Parse(uiProfile.Id);
                                SecurityEntityUtility.Save(mSecurityEntityProfile);
                                mRetVal = true;
                            }
                            else
                            {
                                Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to add");
                                mLog.Error(mError);
                                return(this.InternalServerError(mError));
                            }
                        }
                        else
                        {
                            if (mSecurityInfo.MayAdd)
                            {
                                MSecurityEntityProfile mSecurityEntityProfile = populateSecurityEntity(uiProfile);
                                mSecurityEntityProfile.Id          = -1;
                                mSecurityEntityProfile.AddedBy     = AccountUtility.CurrentProfile().Id;
                                mSecurityEntityProfile.AddedDate   = DateTime.Now;
                                mSecurityEntityProfile.UpdatedBy   = mSecurityEntityProfile.AddedBy;
                                mSecurityEntityProfile.UpdatedDate = mSecurityEntityProfile.AddedDate;
                                SecurityEntityUtility.Save(mSecurityEntityProfile);
                                mRetVal = true;
                            }
                            else
                            {
                                Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to add");
                                mLog.Error(mError);
                                return(this.InternalServerError(mError));
                            }
                        }
                    }
                    else
                    {
                        Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!");
                        mLog.Error(mError);
                        return(this.InternalServerError(mError));
                    }
                }
            }
            else
            {
                Exception mError = new Exception("Security Info is not in context nothing has been saved!!!!");
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            return(this.Ok(mRetVal));
        }
Beispiel #28
0
        public IHttpActionResult SaveNameValuePair(UINVPProfile uiProfile)
        {
            string         mRetVal  = false.ToString();
            MNameValuePair mProfile = new MNameValuePair();
            String         mAction  = GWWebHelper.GetQueryValue(HttpContext.Current.Request, "Action");
            int            mEditId  = int.Parse(HttpContext.Current.Items["EditId"].ToString());
            Logger         mLog     = Logger.Instance();

            if (mEditId != uiProfile.NVP_SEQ_ID)
            {
                Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!");
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }

            MAccountProfile        mUpdatingAccount       = AccountUtility.CurrentProfile();
            MSecurityEntityProfile mSecurityEntityProfile = SecurityEntityUtility.CurrentProfile();
            MSecurityInfo          mSecurityInfo          = new MSecurityInfo(FunctionUtility.GetProfile(mAction), mUpdatingAccount);
            String mGroups        = String.Join(",", uiProfile.Groups);
            String mRoles         = String.Join(",", uiProfile.Roles);
            String mCommaSepRoles = mUpdatingAccount.GetCommaSeparatedAssignedRoles;

            if (uiProfile.NVP_SEQ_ID != -1)
            {
                if (!mSecurityInfo.MayAdd)
                {
                    Exception mError = new Exception("The account (" + mUpdatingAccount.Account + ") being used does not have the correct permissions to add");
                    mLog.Error(mError);
                    return(this.InternalServerError(mError));
                }
            }
            else
            {
                if (!mSecurityInfo.MayAdd)
                {
                    Exception mError = new Exception("The account (" + mUpdatingAccount.Account + ") being used does not have the correct permissions to edit");
                    mLog.Error(mError);
                    return(this.InternalServerError(mError));
                }
            }
            if (uiProfile.NVP_SEQ_ID != -1)
            {
                mProfile = NameValuePairUtility.GetNameValuePair(uiProfile.NVP_SEQ_ID);
            }
            else
            {
                mProfile.AddedBy   = mUpdatingAccount.Id;
                mProfile.AddedDate = DateTime.Today;
            }

            mProfile.UpdatedBy   = mUpdatingAccount.Id;
            mProfile.UpdatedDate = DateTime.Today;
            mProfile.StaticName  = uiProfile.STATIC_NAME;
            mProfile.SchemaName  = uiProfile.SchemaName;
            mProfile.Display     = uiProfile.Display;
            mProfile.Description = uiProfile.Description;
            mProfile.Status      = uiProfile.Status;
            int mID         = NameValuePairUtility.Save(mProfile);
            int mSecurityId = mSecurityEntityProfile.Id;

            NameValuePairUtility.UpdateRoles(mID, mSecurityId, mRoles, mProfile);
            NameValuePairUtility.UpdateGroups(mID, mSecurityId, mGroups, mProfile);
            return(this.Ok(mRetVal));
        }
Beispiel #29
0
        public IHttpActionResult Save(UIFunctionProfile uiProfile)
        {
            if (uiProfile == null)
            {
                throw new ArgumentNullException("uiProfile", "uiProfile cannot be a null reference (Nothing in Visual Basic)!");
            }
            string        mRetVal       = "false";
            MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditFunction", true)), AccountUtility.CurrentProfile());
            Logger        mLog          = Logger.Instance();

            if (HttpContext.Current.Items["EditId"] != null)
            {
                int mEditId = int.Parse(HttpContext.Current.Items["EditId"].ToString());
                if (mEditId == uiProfile.Id)
                {
                    MAccountProfile   mAccountProfile  = AccountUtility.CurrentProfile();
                    MFunctionProfile  profile          = new MFunctionProfile();
                    MDirectoryProfile directoryProfile = new MDirectoryProfile();
                    if (uiProfile.Id != -1)
                    {
                        if (!mSecurityInfo.MayEdit)
                        {
                            Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to edit");
                            mLog.Error(mError);
                            return(this.InternalServerError(mError));
                        }
                        profile             = FunctionUtility.GetProfile(uiProfile.Id);
                        profile.UpdatedBy   = mAccountProfile.Id;
                        profile.UpdatedDate = DateTime.Now;
                    }
                    else
                    {
                        if (!mSecurityInfo.MayAdd)
                        {
                            Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to add");
                            mLog.Error(mError);
                            return(this.InternalServerError(mError));
                        }
                        profile.AddedBy   = mAccountProfile.Id;
                        profile.AddedDate = DateTime.Now;
                    }
                    string viewCommaRoles   = String.Join(",", uiProfile.RolesAndGroups.ViewRoles);
                    string addCommaRoles    = String.Join(",", uiProfile.RolesAndGroups.AddRoles);
                    string editCommaRoles   = String.Join(",", uiProfile.RolesAndGroups.EditRoles);
                    string deleteCommaRoles = String.Join(",", uiProfile.RolesAndGroups.DeleteRoles);

                    string viewCommaGroups   = String.Join(",", uiProfile.RolesAndGroups.ViewGroups);
                    string addCommaGroups    = String.Join(",", uiProfile.RolesAndGroups.AddGroups);
                    string editCommaGroups   = String.Join(",", uiProfile.RolesAndGroups.EditGroups);
                    string deleteCommaGroups = String.Join(",", uiProfile.RolesAndGroups.DeleteGroups);

                    bool saveGroups = false;
                    bool saveRoles  = false;

                    if (profile.GetCommaSeparatedAssignedRoles(PermissionType.View) != viewCommaRoles)
                    {
                        profile.SetAssignedRoles(viewCommaRoles, PermissionType.View);
                        saveRoles = true;
                    }

                    if (profile.GetCommaSeparatedAssignedRoles(PermissionType.Add) != addCommaRoles)
                    {
                        profile.SetAssignedRoles(addCommaRoles, PermissionType.Add);
                        saveRoles = true;
                    }

                    if (profile.GetCommaSeparatedAssignedRoles(PermissionType.Edit) != editCommaRoles)
                    {
                        profile.SetAssignedRoles(editCommaRoles, PermissionType.Edit);
                        saveRoles = true;
                    }

                    if (profile.GetCommaSeparatedAssignedRoles(PermissionType.Delete) != deleteCommaRoles)
                    {
                        profile.SetAssignedRoles(deleteCommaRoles, PermissionType.Delete);
                        saveRoles = true;
                    }

                    if (profile.GetCommaSeparatedGroups(PermissionType.View) != viewCommaGroups)
                    {
                        profile.SetGroups(viewCommaGroups, PermissionType.View);
                        saveGroups = true;
                    }
                    if (profile.GetCommaSeparatedGroups(PermissionType.Add) != addCommaGroups)
                    {
                        profile.SetGroups(addCommaGroups, PermissionType.Add);
                        saveGroups = true;
                    }
                    if (profile.GetCommaSeparatedGroups(PermissionType.Edit) != editCommaGroups)
                    {
                        profile.SetGroups(editCommaGroups, PermissionType.Edit);
                        saveGroups = true;
                    }
                    if (profile.GetCommaSeparatedGroups(PermissionType.Delete) != deleteCommaGroups)
                    {
                        profile.SetGroups(deleteCommaGroups, PermissionType.Delete);
                        saveGroups = true;
                    }
                    profile.Action = uiProfile.Action;
                    profile.EnableNotifications = uiProfile.EnableNotifications;
                    profile.EnableViewState     = uiProfile.EnableViewState;
                    profile.FunctionTypeSeqId   = uiProfile.FunctionTypeSeqID;
                    profile.Id                  = uiProfile.Id;
                    profile.IsNavigable         = uiProfile.IsNav;
                    profile.LinkBehavior        = uiProfile.LinkBehavior;
                    profile.MetaKeywords        = uiProfile.MetaKeyWords;
                    profile.Name                = uiProfile.Name;
                    profile.NavigationTypeSeqId = uiProfile.NavigationTypeSeqId;
                    profile.Notes               = uiProfile.Notes;
                    profile.NoUI                = uiProfile.NoUI;
                    profile.ParentId            = uiProfile.ParentID;
                    profile.Source              = uiProfile.Source;
                    profile.Description         = uiProfile.Description;
                    profile.RedirectOnTimeout   = uiProfile.RedirectOnTimeout;
                    FunctionUtility.Save(profile, saveGroups, saveRoles);
                    profile          = FunctionUtility.GetProfile(uiProfile.Action);
                    directoryProfile = DirectoryUtility.GetProfile(profile.Id);
                    if (!String.IsNullOrEmpty(uiProfile.DirectoryData.Directory))
                    {
                        if (directoryProfile == null)
                        {
                            directoryProfile = new MDirectoryProfile();
                        }
                        directoryProfile.FunctionSeqId       = profile.Id;
                        directoryProfile.Directory           = uiProfile.DirectoryData.Directory;
                        directoryProfile.Impersonate         = uiProfile.DirectoryData.Impersonate;
                        directoryProfile.ImpersonateAccount  = uiProfile.DirectoryData.ImpersonateAccount;
                        directoryProfile.ImpersonatePassword = uiProfile.DirectoryData.ImpersonatePassword;
                        directoryProfile.Name      = uiProfile.DirectoryData.Directory;
                        directoryProfile.UpdatedBy = mAccountProfile.Id;
                        DirectoryUtility.Save(directoryProfile);
                    }
                    else
                    {
                        if (directoryProfile != null)
                        {
                            directoryProfile.Directory = "";
                            directoryProfile.Name      = "";
                            DirectoryUtility.Save(directoryProfile);
                        }
                    }
                    AccountUtility.RemoveInMemoryInformation(true);
                    mRetVal = "true";
                }
                else
                {
                    Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!");
                    mLog.Error(mError);
                    return(this.InternalServerError(mError));
                }
            }
            else
            {
                Exception mError = new Exception("Identifier could not be determined, nothing has been saved!!!!");
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            return(Ok(mRetVal));
        }
Beispiel #30
0
        public static string Decrypt(string textValue)
        {
            string        mRetVal       = "Not Authorized";
            MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_Encryption_Helper", true)), AccountUtility.CurrentProfile());

            if (mSecurityInfo.MayView)
            {
                mRetVal = CryptoUtility.Decrypt(textValue.Trim(), SecurityEntityUtility.CurrentProfile().EncryptionType, ConfigSettings.EncryptionSaltExpression);
            }
            return(mRetVal);
        }