Ejemplo n.º 1
0
        public UserManagerForm()
        {
            InitializeComponent();

            m_adminRole = SCOUT.Core.Security.UserSecurity.Roles.Find
                              ("Id", SCOUT.Core.Security.UserSecurity.Role.AdminRoleId);

            InitBinidngs();

            InitNavRadioBtn(userBtn, userPnl, userListPanel);
            InitNavRadioBtn(roleBtn, rolePnl, roleListPanel);
        }
Ejemplo n.º 2
0
        private void roleEditBtn_Click(object sender, EventArgs e)
        {
            if (!CanSuperAdmin("edit roles"))
            {
                return;
            }

            UserSecurity.Role role = (UserSecurity.Role)rolesBinding.Current;

            RoleEditForm dlg = new RoleEditForm(role);

            dlg.ShowDialog(this);
        }
Ejemplo n.º 3
0
        private void roleDelBtn_Click(object sender, EventArgs e)
        {
            if (!CanSuperAdmin("delete roles"))
            {
                return;
            }

            UserSecurity.Role role = (UserSecurity.Role)rolesBinding.Current;
            InfoBox           ib   = new InfoBox();

            if (role.Id == UserSecurity.Role.AdminRoleId)
            {
                ib.Icon = MessageBoxIcon.Error;
                ib.Show("You cannot delete the administrator role!");

                return;
            }

            DialogResult ans;

            ib.Type    = InfoBoxType.SuperConfirmBox;
            ib.Buttons = MessageBoxButtons.YesNo;
            ib.Icon    = MessageBoxIcon.Warning;

            ans = ib.Show("You are about to delete the \"{0}\" role.\r" +
                          "This operation cannot be undone.\r\r" +
                          "Continue anyway?", role.Name);

            if (ans == DialogResult.Yes)
            {
                try
                {
                    UserSecurity.Roles.Remove(role);
                    UserSecurity.Roles.Save();
                }
                catch (Exception ex)
                {
                    ib = new InfoBox();

                    ib.Icon = MessageBoxIcon.Error;
                    ib.Show("Save Error:\n{0}", ex.Message);
                }
            }
        }