public ActionResult EditRolePermission(Guid roleId, List <string> permissions)
        {
            return(HttpHandleExtensions.AjaxCallGetResult(() =>
            {
                var pList = new List <Guid>();

                foreach (var s in permissions)
                {
                    Guid id;
                    if (Guid.TryParse(s, out id))
                    {
                        pList.Add(id);
                    }
                }

                _roleService.UpdateRolePermission(roleId, pList);

                // 清除用户缓存
                var role = _roleService.FindBy(roleId);
                if (role != null)
                {
                    var users = _roleGroupService.GetUsersIdName(role.RoleGroupId);
                    foreach (var user in users)
                    {
                        AuthorizeManager.ClearUserCache(user.Id);
                    }
                }

                this.JsMessage = MessagesResources.Update_Success;
                return Json(new AjaxResponse
                {
                    Succeeded = true,
                    RedirectUrl = Url.Action("EditRolePermission", new
                    {
                        roleId
                    })
                });
            }));
        }
Пример #2
0
        public ActionResult EditUserList(Guid groupId)
        {
            var group = _roleGroupService.FindBy(groupId);

            var allUsers    = _userService.GetAllUsersIdName();
            var existsUsers = _roleGroupService.GetUsersIdName(groupId);

            ViewBag.Group       = group;
            ViewBag.AllUsers    = allUsers;
            ViewBag.ExistsUsers = existsUsers;

            return(View());
        }