Exemplo n.º 1
0
        /// <summary>
        /// 获取该部门的直接权限
        /// </summary>
        /// <param name="organizationUnitId"></param>
        /// <returns></returns>
        public Task <List <PermissionInfo> > GetPermissions(string organizationUnitId)
        {
            var all = _permissionRoleUserOrganizationUnitRepository.GetAll().Where(u => u.OrganizationUnitId == organizationUnitId).Select(r => r.PermissionId).ToList();

            if (all.Count <= 0)
            {
                return(Task.FromResult(new List <PermissionInfo>()));
            }
            var permissionInfos = _permissionInfoRepository.GetAll().Where(u => all.Contains(u.Id)).ToList();

            return(Task.FromResult(permissionInfos));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取该用户的直接权限
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public List <PermissionInfo> GetPermissions(string userId)
        {
            var all = _permissionRoleUserOrganizationUnit.GetAll().Where(u => u.UserId == userId).Select(r => r.PermissionId).ToList();

            if (all.Count <= 0)
            {
                return(new List <PermissionInfo>());
            }
            var permissionInfos = _permissionInfoRepository.GetAll().Where(u => all.Contains(u.Id)).ToList();

            return(permissionInfos);
        }
Exemplo n.º 3
0
 public List <PermissionInfo> GetPermissionByParentId(string parentId)
 {
     return(_permissionInfoRepository.GetAll().Where(u => u.ParentId == parentId).ToList());
 }