|
|
|
@ -152,15 +152,16 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
|
|
|
|
|
where userOrg.UserId == id
|
|
|
|
|
select ou;
|
|
|
|
|
|
|
|
|
|
var orgUserRoleQuery = DbContext.Set<OrganizationUnitRole>().Where(q => userOrganizationsQuery.Select(t => t.Id).Contains(q.OrganizationUnitId))
|
|
|
|
|
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(
|
|
|
|
@ -201,22 +202,18 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
|
|
|
|
|
where userOu.OrganizationUnitId == organizationUnitId
|
|
|
|
|
select user;
|
|
|
|
|
return await query.ToListAsync(GetCancellationToken(cancellationToken));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<IdentityUser>> GetUsersInOrganizationsListAsync(
|
|
|
|
|
List<Guid> organizationUnitIds,
|
|
|
|
|
CancellationToken cancellationToken = default
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
//var userIds = DbContext.Set<IdentityUserOrganizationUnit>()
|
|
|
|
|
// .Where(q => organizationUnitIds.Contains(q.OrganizationUnitId))
|
|
|
|
|
// .Select(u => u.UserId);
|
|
|
|
|
//var query = DbContext.Users.Where(u => userIds.Contains(u.Id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<IdentityUser>> GetUsersInOrganizationsListAsync(
|
|
|
|
|
List<Guid> organizationUnitIds,
|
|
|
|
|
CancellationToken cancellationToken = default
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
var query = from userOu in DbContext.Set<IdentityUserOrganizationUnit>()
|
|
|
|
|
join user in DbSet on userOu.UserId equals user.Id
|
|
|
|
|
where organizationUnitIds.Contains(userOu.OrganizationUnitId)
|
|
|
|
|
select user;
|
|
|
|
|
return await query.ToListAsync(GetCancellationToken(cancellationToken));
|
|
|
|
|
return await query.ToListAsync(GetCancellationToken(cancellationToken));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual async Task<List<IdentityUser>> GetUsersInOrganizationUnitWithChildrenAsync(
|
|
|
|
@ -235,6 +232,6 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
|
|
|
|
|
public override IQueryable<IdentityUser> WithDetails()
|
|
|
|
|
{
|
|
|
|
|
return GetQueryable().IncludeDetails();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|