예제 #1
0
        private async Task <AddUsersToRoleData> CreateFilledAddUsersToRoleDataAsync(FindUserData userData, int roleID)
        {
            var selectedRole = await SecurityGuiHelper.GetRoleAsync(roleID);

            return(new AddUsersToRoleData(userData)
            {
                SelectedRoleDescription = selectedRole?.RoleDescription ?? string.Empty, SelectedRoleID = selectedRole?.RoleID ?? 0
            });
        }
예제 #2
0
        public async Task <ActionResult> EditRole(int roleId)
        {
            if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SecurityManagement))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var data = new AddEditRoleData {
                RoleEdited = await SecurityGuiHelper.GetRoleAsync(roleId)
            };

            if (data.RoleEdited == null)
            {
                return(RedirectToRoute("ManageRoles"));
            }

            await FillAddEditRoleDataAsync(data);

            data.SystemRightsSet = SecurityGuiHelper.GetAllSystemActionRightIDsForRole(roleId);
            data.AuditActionsSet = SecurityGuiHelper.GetAllAuditActionIDsForRole(roleId);
            return(View("~/Views/Admin/EditRole.cshtml", data));
        }