|
|
|
@ -8,7 +8,6 @@ using System.Threading.Tasks; |
|
|
|
using MongoDB.Driver; |
|
|
|
using MongoDB.Driver.Linq; |
|
|
|
using Volo.Abp.Domain.Repositories.MongoDB; |
|
|
|
using Volo.Abp.Guids; |
|
|
|
using Volo.Abp.MongoDB; |
|
|
|
|
|
|
|
namespace Volo.Abp.Identity.MongoDB |
|
|
|
@ -58,13 +57,13 @@ namespace Volo.Abp.Identity.MongoDB |
|
|
|
|
|
|
|
var organizationUnitIds = user.OrganizationUnits |
|
|
|
.Select(r => r.OrganizationUnitId) |
|
|
|
.ToArray(); |
|
|
|
|
|
|
|
.ToArray(); |
|
|
|
|
|
|
|
var organizationUnits = DbContext.OrganizationUnits |
|
|
|
.AsQueryable() |
|
|
|
.Where(ou => organizationUnitIds.Contains(ou.Id)) |
|
|
|
.ToArray(); |
|
|
|
|
|
|
|
.ToArray(); |
|
|
|
|
|
|
|
var roleIds = organizationUnits.SelectMany(x => x.Roles.Select(r => r.RoleId)).ToArray(); |
|
|
|
|
|
|
|
return await DbContext.Roles //TODO: Such usage suppress filters!
|
|
|
|
@ -202,15 +201,15 @@ namespace Volo.Abp.Identity.MongoDB |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<List<IdentityUser>> GetUsersInOrganizationsListAsync( |
|
|
|
List<Guid> organizationUnitIds, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
public async Task<List<IdentityUser>> GetUsersInOrganizationsListAsync( |
|
|
|
List<Guid> organizationUnitIds, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
var result = await GetMongoQueryable() |
|
|
|
.Where(u => u.OrganizationUnits.Any(uou => organizationUnitIds.Contains(uou.OrganizationUnitId))) |
|
|
|
.ToListAsync(GetCancellationToken(cancellationToken)) |
|
|
|
; |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<List<IdentityUser>> GetUsersInOrganizationUnitWithChildrenAsync( |
|
|
|
@ -227,6 +226,6 @@ namespace Volo.Abp.Identity.MongoDB |
|
|
|
.Where(u => u.OrganizationUnits.Any(uou => organizationUnitIds.Contains(uou.OrganizationUnitId))) |
|
|
|
.ToListAsync(GetCancellationToken(cancellationToken)) |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|