Esempio n. 1
0
        private void userRoleList_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (e.NewValue != CheckState.Checked)
            {
                return;
            }

            if (SCOUT.Core.Security.UserSecurity.CurrentUser
                .CanPerform(SCOUT.Core.Security.UserSecurity.Action.AdministrateAdmins))
            {
                return;
            }

            /*
             * Don't user's who aren't supposed to be allowed to edit admins
             * be able to add them!
             */
            SCOUT.Core.Security.UserSecurity.Role adminRole = SCOUT.Core.Security.UserSecurity.Roles.Find("Id",
                                                                                                          SCOUT.Core.Security.UserSecurity.Role.AdminRoleId);

            if (e.Index == SCOUT.Core.Security.UserSecurity.Roles.IndexOf(adminRole))
            {
                InfoBox ib = new InfoBox();

                ib.Icon = MessageBoxIcon.Error;
                ib.Show("You cannot add aministrators.");

                e.NewValue = CheckState.Unchecked;

                return;
            }
        }
Esempio n. 2
0
        public RoleEditForm(SCOUT.Core.Security.UserSecurity.Role role)
        {
            InitializeComponent();

            if (role == null)
            {
                m_role = SCOUT.Core.Security.UserSecurity.Roles.AddNew();
                Text   = "New Role";
            }
            else
            {
                m_role = role;
                Text   = "Editing: " + m_role.Name;
            }

            InitBindings();
        }