|
|
@ -6,6 +6,7 @@ using System.Security.Claims; |
|
|
using System.Threading; |
|
|
using System.Threading; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Internal; |
|
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|
|
using Volo.Abp.EntityFrameworkCore; |
|
|
using Volo.Abp.EntityFrameworkCore; |
|
|
|
|
|
|
|
|
@ -139,17 +140,22 @@ namespace Volo.Abp.Identity.EntityFrameworkCore |
|
|
join role in DbContext.Roles.IncludeDetails(includeDetails) on userRole.RoleId equals role.Id |
|
|
join role in DbContext.Roles.IncludeDetails(includeDetails) on userRole.RoleId equals role.Id |
|
|
where userRole.UserId == id |
|
|
where userRole.UserId == id |
|
|
select role; |
|
|
select role; |
|
|
//TODO
|
|
|
|
|
|
//var q2 = from userOrganization in DbContext.Set<IdentityUserOrganizationUnit>()
|
|
|
|
|
|
// join userOrg in DbContext.OrganizationUnits.IncludeDetails(includeDetails) on userOrganization.UserId equals id
|
|
|
|
|
|
// select userOrg.Roles;
|
|
|
|
|
|
//var q3 = from ouRole in DbContext.Set<OrganizationUnitRole>()
|
|
|
|
|
|
// join role in DbContext.Roles.IncludeDetails(includeDetails) on ouRole.RoleId equals role.Id
|
|
|
|
|
|
// where ouRole.RoleId == id
|
|
|
|
|
|
// select role;
|
|
|
|
|
|
//query = q2.Union(query);
|
|
|
|
|
|
|
|
|
|
|
|
return await query.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
//TODO: Needs improvement
|
|
|
|
|
|
var userOrganizationsQuery = from userOrg in DbContext.Set<IdentityUserOrganizationUnit>() |
|
|
|
|
|
join ou in DbContext.OrganizationUnits.IncludeDetails(includeDetails) on userOrg.OrganizationUnitId equals ou.Id |
|
|
|
|
|
where userOrg.UserId == id |
|
|
|
|
|
select ou; |
|
|
|
|
|
|
|
|
|
|
|
var orgUserRoleQuery = DbContext.Set<OrganizationUnitRole>().Where(q => userOrganizationsQuery.Select(t => t.Id).Contains(q.OrganizationUnitId)) |
|
|
|
|
|
.Select(t => t.RoleId); |
|
|
|
|
|
|
|
|
|
|
|
var orgRoles = DbContext.Roles.Where(q => orgUserRoleQuery.Contains(q.Id)); |
|
|
|
|
|
var resultQuery = query.Union(orgRoles); |
|
|
|
|
|
|
|
|
|
|
|
return await resultQuery.ToListAsync(GetCancellationToken(cancellationToken)); |
|
|
|
|
|
|
|
|
|
|
|
//return await query.ToListAsync(GetCancellationToken(cancellationToken));
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public virtual async Task<long> GetCountAsync( |
|
|
public virtual async Task<long> GetCountAsync( |
|
|
|