コード例 #1
0
 public async Task <ActionResult> AddUsersToRole_UsersSelected(AddUsersToRoleData data, string submitAction)
 {
     return(await ActionWithUserSearch_UserSelectedAsync(async d => await CreateFilledAddUsersToRoleDataAsync(d, data.SelectedRoleID), data.FindUserData,
                                                         submitAction, async() => await AddUsersToRole(data.SelectedRoleID),
                                                         async d => await AddUsersToRole_Find(data), "AddUsersToRole_Perform",
                                                         "~/Views/Admin/AddUsersToRole.cshtml"));
 }
コード例 #2
0
        public async Task <ActionResult> AddUsersToRole_Perform(AddUsersToRoleData data, string submitAction)
        {
            if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.UserManagement))
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (submitAction != "Add")
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (data.FindUserData.SelectedUserIDs == null || data.FindUserData.SelectedUserIDs.Count <= 0)
            {
                return(await AddUsersToRole_Find(data));
            }

            await SecurityManager.AddUsersToRoleAsync(data.FindUserData.SelectedUserIDs, data.SelectedRoleID);

            // simply redirect to manage users per role route
            return(RedirectToRoute("ManageUsersPerRole"));
        }
コード例 #3
0
 public async Task <ActionResult> AddUsersToRole_Find(AddUsersToRoleData data)
 {
     return(await ActionWithUserSearch_FindAsync(async d => await CreateFilledAddUsersToRoleDataAsync(d, data.SelectedRoleID), data.FindUserData,
                                                 "Add selected users to role", "AddUsersToRole_UsersSelected", "AddUsersToRole_Find",
                                                 "~/Views/Admin/AddUsersToRole.cshtml", false, data.SelectedRoleID));
 }