/// <summary> /// 权限项对应的组织范围 /// </summary> /// <param name="permissionId"></param> /// <returns></returns> public async Task <ResponseMessage <List <string> > > GetPermisionScopeList(string permissionId) { var response = new ResponseMessage <List <string> >(); if (permissionId == null) { throw new Exception("请求参数为空"); } try { response.Extension = await _IRolesStore.GetRolePermissionsAsync().Where(u => u.PermissionsId.Equals(permissionId)).Select(p => p.OrganizationScope).ToListAsync(); } catch (Exception el) { throw new Exception(el.Message); } return(response); }
/// <summary> /// 该用户的所有权限Id集合 /// </summary> /// <param name="UerId"></param> /// <returns></returns> public async Task <List <string> > ReturnAuthorityName(string UerId) { //用户角色 var UserRole = from b in _IRolesStore.GetUserRoleAsync().Where(p => p.UserId == UerId) join c in _IRolesStore.GetRolePermissionsAsync() on b.RoleId equals c.RoledId into b1 from c1 in b1.DefaultIfEmpty() select c1; return(await UserRole.Select(p => p.PermissionsId).Distinct().ToListAsync()); }
/// <summary> /// 获取该用户的所有的权限列表 /// </summary> /// <returns></returns> public async Task <ResponseMessage <List <string> > > JurisdictionList(string useId) { var response = new ResponseMessage <List <string> >(); try { var UserRole = from b in _IRolesStore.GetUserRoleAsync().Where(p => p.UserId == useId && !p.IsDeleted) join c in _IRolesStore.GetRolePermissionsAsync() on b.RoleId equals c.RoledId into b1 from c1 in b1.DefaultIfEmpty() select c1; response.Extension = await UserRole.Select(p => p.PermissionsId).Distinct().ToListAsync(); } catch (Exception el) { throw new Exception(el.Message); } return(response); }