Пример #1
0
        private void populateGeneral()
        {
            //litFunctionSeqId.Text = m_Profile.Id.ToString();
            divFunctionSeqId.InnerHtml = m_Profile.Id.ToString();
            txtName.Value        = m_Profile.Name;
            txtDescription.Value = m_Profile.Description;
            txtNotes.Text        = m_Profile.Notes;
            txtKeyWords.Text     = m_Profile.MetaKeywords;

            divAction.InnerHtml = m_Profile.Action;
            divAction.Visible   = true;
            txtAction.Text      = m_Profile.Action;
            //txtAction.Visible = false;

            txtSource.Text = m_Profile.Source;

            chkEnableViewState.Checked     = m_Profile.EnableViewState;
            chkEnableNotifications.Checked = m_Profile.EnableNotifications;
            chkRedirectOnTimeout.Checked   = m_Profile.RedirectOnTimeout;
            chkNoUI.Checked  = m_Profile.NoUI;
            chkIsNav.Checked = m_Profile.IsNavigable;

            RolesControl.AllRoles            = RoleUtility.GetRolesArrayListBySecurityEntity(SecurityEntityUtility.CurrentProfile().Id);
            RolesControl.SelectedAddRoles    = m_Profile.AssignedAddRoles.ToArray();
            RolesControl.SelectedDeleteRoles = m_Profile.AssignedDeleteRoles.ToArray();
            RolesControl.SelectedEditRoles   = m_Profile.AssignedEditRoles.ToArray();
            RolesControl.SelectedViewRoles   = m_Profile.AssignedViewRoles.ToArray();

            GroupsControl.AllGroups            = GroupUtility.GetGroupsArrayListBySecurityEntity(SecurityEntityUtility.CurrentProfile().Id);
            GroupsControl.SelectedAddGroups    = m_Profile.AddGroups.ToArray();
            GroupsControl.SelectedDeleteGroups = m_Profile.DeleteGroups.ToArray();
            GroupsControl.SelectedEditGroups   = m_Profile.EditGroups.ToArray();
            GroupsControl.SelectedViewGroups   = m_Profile.ViewGroups.ToArray();
        }
Пример #2
0
        public static string[] GetAllRoles(HttpServerUtility server)
        {
            string[]    roleList;
            RoleUtility ru = new RoleUtility();

            roleList = ru.GetAllRoles(server);
            return(roleList);
        }
Пример #3
0
 private void populateRoles()
 {
     ctlRoles.DataSource    = RoleUtility.GetRolesArrayListBySecurityEntity(SecurityEntityUtility.CurrentProfile().Id);
     ctlRoles.SelectedItems = m_Profile.AssignedRoles.ToArray();
     ctlRoles.DataBind();
     foreach (String role in m_Profile.DerivedRoles)
     {
         lstBoxRoles.Items.Add(role);
     }
 }
Пример #4
0
        /// <summary>
        /// 加载自动战斗配置。
        /// </summary>
        /// <returns>自动战斗配置数据。</returns>
        public static AutoAIConfig LoadConfig()
        {
            AutoAIConfig cfg = new AutoAIConfig();

            cfg.m_KeepLifePercent = RoleUtility.GetFloat(KEY_KEEPLIFE_PERCENT, 0.5f);
            cfg.m_BuyPotion       = RoleUtility.GetBool(KEY_BUY_POTION, false);
            cfg.m_Relive          = RoleUtility.GetBool(KEY_RELIVE, false);
            cfg.m_UseSpecialSkill = RoleUtility.GetBool(KEY_USE_SPECIAL_SKILL, false);
            return(cfg);
        }
Пример #5
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));
        }
Пример #6
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();
        }
Пример #7
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        /// <param name="searchCriteria">The search criteria.</param>
        private void bindData(MSearchCriteria searchCriteria)
        {
            //DataTable mDataTable = FunctionUtility.Search(searchCriteria);
            DataTable mDataTable = RoleUtility.Search(searchCriteria);

            if (mDataTable != null && mDataTable.Rows.Count > 0)
            {
                DataView mDataView = mDataTable.DefaultView;
                recordsReturned.Value    = mDataTable.Rows[0][0].ToString();
                searchResults.DataSource = mDataTable;
                searchResults.DataBind();
            }
            else
            {
                noResults.Visible = true;
            }
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string mRoleSeqId = GWWebHelper.GetQueryValue(Request, "RoleSeqID");

            if (!String.IsNullOrEmpty(mRoleSeqId))
            {
                int mRoleID = int.Parse(mRoleSeqId);
                if (mRoleID != -1)
                {
                    m_Profile = RoleUtility.GetProfile(mRoleID);
                }
                else
                {
                    m_Profile = new MRoleProfile();
                }
                HttpContext.Current.Session.Add("EditId", m_Profile.Id);
                populatePage();
            }
        }
Пример #9
0
        public IHttpActionResult Delete([FromUri] int roleSeqId)
        {
            string        mRetVal       = "false";
            MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditRoles", 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 == roleSeqId)
                    {
                        MRoleProfile mProfile = RoleUtility.GetProfile(roleSeqId);
                        RoleUtility.DeleteRole(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));
        }
Пример #10
0
        private void populateRolesAndGroups(MNameValuePair profile)
        {
            int      mSecurityEntityId = int.Parse(ClientChoicesState[MClientChoices.SecurityEntityId].ToString());
            DataView mDVRoles          = RoleUtility.GetAllRolesBySecurityEntity(mSecurityEntityId).DefaultView;
            DataView mDVGroups         = GroupUtility.GetAllGroupsBySecurityEntity(mSecurityEntityId).DefaultView;

            try
            {
                ctlGroups.SelectedItems = NameValuePairUtility.GetSelectedGroups(m_NVPToUpdate.Id);
                ctlRoles.SelectedItems  = NameValuePairUtility.GetSelectedRoles(m_NVPToUpdate.Id);
            }
            catch (Exception ex)
            {
                Logger mLog = Logger.Instance();
                mLog.Debug(ex);
            }
            ctlGroups.DataSource = mDVGroups;
            ctlGroups.DataField  = "Name";
            ctlGroups.DataBind();
            ctlRoles.DataSource = mDVRoles;
            ctlRoles.DataField  = "Name";
            ctlRoles.DataBind();
        }
Пример #11
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));
        }
Пример #12
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();
        }