diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs index f14dce6181..c18f2c16b5 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs @@ -31,8 +31,5 @@ namespace Volo.Abp.Identity [CanBeNull] public string[] RoleNames { get; set; } - - [CanBeNull] - public Guid[] OrganizationUnits { get; set; } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs index b7228b05a1..76eda9378f 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs @@ -198,7 +198,7 @@ namespace Volo.Abp.Identity return await OrganizationUnitRepository.GetListAsync( user.OrganizationUnits.Select(t => t.OrganizationUnitId), - CancellationToken + cancellationToken: CancellationToken ); } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/IOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/IOrganizationUnitRepository.cs index 03c34e3170..b914e859ef 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/IOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/IOrganizationUnitRepository.cs @@ -8,12 +8,29 @@ namespace Volo.Abp.Identity.Organizations { public interface IOrganizationUnitRepository : IBasicRepository { - Task> GetChildrenAsync(Guid? parentId, CancellationToken cancellationToken = default); + Task> GetChildrenAsync( + Guid? parentId, + bool includeDetails = false, + CancellationToken cancellationToken = default + ); - Task> GetAllChildrenWithParentCodeAsync(string code, Guid? parentId, CancellationToken cancellationToken = default); + Task> GetAllChildrenWithParentCodeAsync( + string code, + Guid? parentId, + bool includeDetails = false, + CancellationToken cancellationToken = default + ); - Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default); + Task> GetListAsync( + IEnumerable ids, + bool includeDetails = false, + CancellationToken cancellationToken = default + ); - Task GetOrganizationUnitAsync(string displayName, bool includeDetails = false, CancellationToken cancellationToken = default); + Task GetOrganizationUnitAsync( + string displayName, + bool includeDetails = false, + CancellationToken cancellationToken = default + ); } } diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs index 0aa90df8ac..38cac16b3e 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs @@ -22,9 +22,11 @@ namespace Volo.Abp.Identity.EntityFrameworkCore public async Task> GetChildrenAsync( Guid? parentId, + bool includeDetails = false, CancellationToken cancellationToken = default) { return await DbSet + .IncludeDetails(includeDetails) .Where(x => x.ParentId == parentId) .ToListAsync(GetCancellationToken(cancellationToken)); } @@ -32,18 +34,22 @@ namespace Volo.Abp.Identity.EntityFrameworkCore public async Task> GetAllChildrenWithParentCodeAsync( string code, Guid? parentId, + bool includeDetails = false, CancellationToken cancellationToken = default) { return await DbSet + .IncludeDetails(includeDetails) .Where(ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value) .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetListAsync( IEnumerable ids, + bool includeDetails = false, CancellationToken cancellationToken = default) { return await DbSet + .IncludeDetails(includeDetails) .Where(t => ids.Contains(t.Id)) .ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs index 879bd0acb5..5f11fa8477 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs @@ -21,6 +21,7 @@ namespace Volo.Abp.Identity.MongoDB public async Task> GetChildrenAsync( Guid? parentId, + bool includeDetails = false, CancellationToken cancellationToken = default) { return await GetMongoQueryable() @@ -31,6 +32,7 @@ namespace Volo.Abp.Identity.MongoDB public async Task> GetAllChildrenWithParentCodeAsync( string code, Guid? parentId, + bool includeDetails = false, CancellationToken cancellationToken = default) { return await GetMongoQueryable() @@ -38,7 +40,10 @@ namespace Volo.Abp.Identity.MongoDB .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) + public async Task> GetListAsync( + IEnumerable ids, + bool includeDetails = false, + CancellationToken cancellationToken = default) { return await GetMongoQueryable() .Where(t => ids.Contains(t.Id))