From 58888316e770acadecd9340adc41e3961d33cf3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=B4=AA=E6=9E=97?= Date: Fri, 4 Sep 2020 16:00:55 +0800 Subject: [PATCH 1/6] add OrganizaitonUnit GetListAsync filter paramter --- .../Identity/IOrganizationUnitRepository.cs | 1 + .../EfCoreOrganizationUnitRepository.cs | 31 ++++++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs index 6650f62c82..e12d5a5f6d 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs @@ -31,6 +31,7 @@ namespace Volo.Abp.Identity string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, + string filter = null, 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 7bdb7d6837..26dcc27426 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 @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; +using System.IO; using System.Linq.Dynamic.Core; using System.Linq; using System.Threading; @@ -12,7 +13,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { public class EfCoreOrganizationUnitRepository : EfCoreRepository, - IOrganizationUnitRepository + IOrganizationUnitRepository { public EfCoreOrganizationUnitRepository( IDbContextProvider dbContextProvider) @@ -47,15 +48,20 @@ namespace Volo.Abp.Identity.EntityFrameworkCore string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, + string filter = null, bool includeDetails = true, CancellationToken cancellationToken = default) { return await DbSet .IncludeDetails(includeDetails) + .WhereIf(!filter.IsNullOrWhiteSpace(), + ou => ou.DisplayName.Contains(filter) || + ou.Code.Contains(filter)) .OrderBy(sorting ?? nameof(OrganizationUnit.DisplayName)) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } + public virtual async Task> GetListAsync( IEnumerable ids, bool includeDetails = false, @@ -89,9 +95,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore CancellationToken cancellationToken = default) { var query = from organizationRole in DbContext.Set() - join role in DbContext.Roles.IncludeDetails(includeDetails) on organizationRole.RoleId equals role.Id - where organizationRole.OrganizationUnitId == organizationUnit.Id - select role; + join role in DbContext.Roles.IncludeDetails(includeDetails) on organizationRole.RoleId equals role.Id + where organizationRole.OrganizationUnitId == organizationUnit.Id + select role; query = query .OrderBy(sorting ?? nameof(IdentityRole.Name)) .PageBy(skipCount, maxResultCount); @@ -104,9 +110,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore CancellationToken cancellationToken = default) { var query = from organizationRole in DbContext.Set() - join role in DbContext.Roles on organizationRole.RoleId equals role.Id - where organizationRole.OrganizationUnitId == organizationUnit.Id - select role; + join role in DbContext.Roles on organizationRole.RoleId equals role.Id + where organizationRole.OrganizationUnitId == organizationUnit.Id + select role; return await query.CountAsync(GetCancellationToken(cancellationToken)); } @@ -119,13 +125,13 @@ namespace Volo.Abp.Identity.EntityFrameworkCore string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default - ) + ) { var query = CreateGetMembersFilteredQuery(organizationUnit, filter); return await query.IncludeDetails(includeDetails).OrderBy(sorting ?? nameof(IdentityUser.UserName)) - .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task GetMembersCountAsync( @@ -162,7 +168,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore DbContext.Set().RemoveRange(ouMembersQuery); } - protected virtual IQueryable CreateGetMembersFilteredQuery(OrganizationUnit organizationUnit, string filter = null) + protected virtual IQueryable CreateGetMembersFilteredQuery(OrganizationUnit organizationUnit, + string filter = null) { var query = from userOu in DbContext.Set() join user in DbContext.Users on userOu.UserId equals user.Id @@ -181,4 +188,4 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return query; } } -} +} \ No newline at end of file From c428ac27a608bb2586747f8f54b354d2b36798b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=B4=AA=E6=9E=97?= Date: Fri, 4 Sep 2020 16:55:00 +0800 Subject: [PATCH 2/6] add filter paremeter and getCount api --- .../Identity/IOrganizationUnitRepository.cs | 5 +++ .../EfCoreOrganizationUnitRepository.cs | 10 +++++ .../MongoOrganizationUnitRepository.cs | 43 +++++++++++++------ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs index e12d5a5f6d..561abd893f 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs @@ -81,5 +81,10 @@ namespace Volo.Abp.Identity OrganizationUnit organizationUnit, CancellationToken cancellationToken = default ); + + Task GetLongCountAsync( + Guid? parentId, + string filter = null, + 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 26dcc27426..311bb1a3dc 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 @@ -168,6 +168,16 @@ namespace Volo.Abp.Identity.EntityFrameworkCore DbContext.Set().RemoveRange(ouMembersQuery); } + public virtual async Task GetLongCountAsync(Guid? parentId, string filter = null, + CancellationToken cancellationToken = default) + { + return await DbSet + .WhereIf(!filter.IsNullOrWhiteSpace(), ou => + ou.DisplayName.Contains(filter) || + ou.Code.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + protected virtual IQueryable CreateGetMembersFilteredQuery(OrganizationUnit organizationUnit, string filter = null) { 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 8c163d4126..a31acf13ad 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 @@ -16,7 +16,7 @@ namespace Volo.Abp.Identity.MongoDB { public class MongoOrganizationUnitRepository : MongoDbRepository, - IOrganizationUnitRepository + IOrganizationUnitRepository { public MongoOrganizationUnitRepository( IMongoDbContextProvider dbContextProvider) @@ -41,8 +41,8 @@ namespace Volo.Abp.Identity.MongoDB CancellationToken cancellationToken = default) { return await GetMongoQueryable() - .Where(ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value) - .ToListAsync(GetCancellationToken(cancellationToken)); + .Where(ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value) + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync( @@ -51,22 +51,26 @@ namespace Volo.Abp.Identity.MongoDB CancellationToken cancellationToken = default) { return await GetMongoQueryable() - .Where(t => ids.Contains(t.Id)) - .ToListAsync(GetCancellationToken(cancellationToken)); + .Where(t => ids.Contains(t.Id)) + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync( string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, + string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default) { return await GetMongoQueryable() - .OrderBy(sorting ?? nameof(OrganizationUnit.DisplayName)) - .As>() - .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); + .WhereIf(!filter.IsNullOrWhiteSpace(), + ou => ou.DisplayName.Contains(filter) || + ou.Code.Contains(filter)) + .OrderBy(sorting ?? nameof(OrganizationUnit.DisplayName)) + .As>() + .PageBy>(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task GetAsync( @@ -135,13 +139,15 @@ namespace Volo.Abp.Identity.MongoDB return await query.CountAsync(GetCancellationToken(cancellationToken)); } - public virtual Task RemoveAllRolesAsync(OrganizationUnit organizationUnit, CancellationToken cancellationToken = default) + public virtual Task RemoveAllRolesAsync(OrganizationUnit organizationUnit, + CancellationToken cancellationToken = default) { organizationUnit.Roles.Clear(); return Task.FromResult(0); } - public virtual async Task RemoveAllMembersAsync(OrganizationUnit organizationUnit, CancellationToken cancellationToken = default) + public virtual async Task RemoveAllMembersAsync(OrganizationUnit organizationUnit, + CancellationToken cancellationToken = default) { var users = await DbContext.Users.AsQueryable() .Where(u => u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == organizationUnit.Id)) @@ -155,7 +161,18 @@ namespace Volo.Abp.Identity.MongoDB } } - protected virtual IMongoQueryable CreateGetMembersFilteredQuery(OrganizationUnit organizationUnit, string filter = null) + public virtual async Task GetLongCountAsync(Guid? parentId, string filter = null, + CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .WhereIf>(!filter.IsNullOrWhiteSpace(), ou => + ou.DisplayName.Contains(filter) || + ou.Code.Contains(filter)) + .LongCountAsync(GetCancellationToken(cancellationToken)); + } + + protected virtual IMongoQueryable CreateGetMembersFilteredQuery(OrganizationUnit organizationUnit, + string filter = null) { return DbContext.Users.AsQueryable() .Where(u => u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == organizationUnit.Id)) @@ -168,4 +185,4 @@ namespace Volo.Abp.Identity.MongoDB ); } } -} +} \ No newline at end of file From 62277ec59e5d78e31ca7ad9b205ecb54d66fa030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=B4=AA=E6=9E=97?= Date: Sun, 6 Sep 2020 15:35:05 +0800 Subject: [PATCH 3/6] add create role with org details unit test --- .../Identity/IdentityRoleAppService_Tests.cs | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs index 5d64bb6c78..0126758eb8 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs @@ -11,11 +11,14 @@ namespace Volo.Abp.Identity { private readonly IIdentityRoleAppService _roleAppService; private readonly IIdentityRoleRepository _roleRepository; - + private readonly IOrganizationUnitRepository _organizationUnitRepository; + private readonly OrganizationUnitManager _organization; public IdentityRoleAppService_Tests() { _roleAppService = GetRequiredService(); _roleRepository = GetRequiredService(); + _organization = GetRequiredService(); + _organizationUnitRepository=GetRequiredService(); } [Fact] @@ -81,6 +84,32 @@ namespace Volo.Abp.Identity role.Name.ShouldBe(input.Name); } + [Fact] + public async Task CreateWithDetailsAsync() + { + //Arrange + var input = new IdentityRoleCreateDto + { + Name = Guid.NewGuid().ToString("N").Left(8) + }; + + var orgInput=new OrganizationUnit( + _organization.GuidGenerator.Create(), + Guid.NewGuid().ToString("N").Left(8) + ); + + //Act + var result = await _roleAppService.CreateAsync(input); + + await _organization.CreateAsync(orgInput); + + await _organization.AddRoleToOrganizationUnitAsync(result.Id,orgInput.Id); + + var orgRolesCount=await _organizationUnitRepository.GetRolesCountAsync(orgInput); + //Assert + orgRolesCount.ShouldBeGreaterThan(0); + } + [Fact] public async Task UpdateAsync() { From c02fdae537d43da1f33d8c42c2342944e9be8bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=B4=AA=E6=9E=97?= Date: Sun, 6 Sep 2020 16:27:15 +0800 Subject: [PATCH 4/6] fixed CreateWithDetails unit test --- .../Volo/Abp/Identity/IdentityRoleAppService_Tests.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs index 0126758eb8..b32c830002 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs @@ -102,12 +102,11 @@ namespace Volo.Abp.Identity var result = await _roleAppService.CreateAsync(input); await _organization.CreateAsync(orgInput); - - await _organization.AddRoleToOrganizationUnitAsync(result.Id,orgInput.Id); - - var orgRolesCount=await _organizationUnitRepository.GetRolesCountAsync(orgInput); + + var role = await _roleRepository.GetAsync(result.Id); + await _organization.AddRoleToOrganizationUnitAsync(role,orgInput); //Assert - orgRolesCount.ShouldBeGreaterThan(0); + orgInput.Roles.Count.ShouldBeGreaterThan(0); } [Fact] From a6d7ff959499b96e09c9715392531287ad5a73b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=B4=AA=E6=9E=97?= Date: Wed, 9 Sep 2020 21:07:58 +0800 Subject: [PATCH 5/6] fixed parentId parameter and tested complete --- .../Identity/IOrganizationUnitRepository.cs | 1 + .../EfCoreOrganizationUnitRepository.cs | 3 +++ .../MongoDB/MongoOrganizationUnitRepository.cs | 3 +++ .../OrganizationUnitRepository_Tests.cs | 18 +++++++++++++++++- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs index 561abd893f..0e6272064d 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IOrganizationUnitRepository.cs @@ -28,6 +28,7 @@ namespace Volo.Abp.Identity ); Task> GetListAsync( + Guid? parentId, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, 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 311bb1a3dc..7dd1901fbc 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 @@ -45,6 +45,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore } public virtual async Task> GetListAsync( + Guid? parentId, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, @@ -54,6 +55,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { return await DbSet .IncludeDetails(includeDetails) + .Where(ou=>ou.ParentId==parentId) .WhereIf(!filter.IsNullOrWhiteSpace(), ou => ou.DisplayName.Contains(filter) || ou.Code.Contains(filter)) @@ -172,6 +174,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore CancellationToken cancellationToken = default) { return await DbSet + .Where(ou=>ou.ParentId==parentId) .WhereIf(!filter.IsNullOrWhiteSpace(), ou => ou.DisplayName.Contains(filter) || ou.Code.Contains(filter)) 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 a31acf13ad..73397636f5 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 @@ -56,6 +56,7 @@ namespace Volo.Abp.Identity.MongoDB } public virtual async Task> GetListAsync( + Guid? parentId, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, @@ -64,6 +65,7 @@ namespace Volo.Abp.Identity.MongoDB CancellationToken cancellationToken = default) { return await GetMongoQueryable() + .Where(ou=>ou.ParentId==parentId) .WhereIf(!filter.IsNullOrWhiteSpace(), ou => ou.DisplayName.Contains(filter) || ou.Code.Contains(filter)) @@ -165,6 +167,7 @@ namespace Volo.Abp.Identity.MongoDB CancellationToken cancellationToken = default) { return await GetMongoQueryable() + .Where(ou=>ou.ParentId==parentId) .WhereIf>(!filter.IsNullOrWhiteSpace(), ou => ou.DisplayName.Contains(filter) || ou.Code.Contains(filter)) diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs index bb8300d449..2725441719 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs @@ -59,6 +59,22 @@ namespace Volo.Abp.Identity var ous = await _organizationUnitRepository.GetListAsync(ouIds); ous.Count.ShouldBe(2); ous.ShouldContain(ou => ou.Id == ouIds.First()); + + var ou11 = await _organizationUnitRepository.GetAsync("OU11"); + ou11.ShouldNotBeNull(); + var ou11Children = await _organizationUnitRepository.GetListAsync(ou11.Id, includeDetails: true); + ou11Children.Count.ShouldBe(2); + } + + [Fact] + public async Task GetLongCountAsync() + { + (await _organizationUnitRepository.GetLongCountAsync(_guidGenerator.Create(), filter: "11")).ShouldBe(0); + var countRoot = await _organizationUnitRepository.GetLongCountAsync(null, filter: "1"); + countRoot.ShouldBe(1); + var ou11 = await _organizationUnitRepository.GetAsync("OU11"); + ou11.ShouldNotBeNull(); + (await _organizationUnitRepository.GetLongCountAsync(ou11.Id, "2")).ShouldBe(1); } [Fact] @@ -192,7 +208,7 @@ namespace Volo.Abp.Identity { OrganizationUnit ou1 = await _organizationUnitRepository.GetAsync("OU111", true); OrganizationUnit ou2 = await _organizationUnitRepository.GetAsync("OU112", true); - var users = await _identityUserRepository.GetUsersInOrganizationsListAsync(new List {ou1.Id, ou2.Id}); + var users = await _identityUserRepository.GetUsersInOrganizationsListAsync(new List { ou1.Id, ou2.Id }); users.Count.ShouldBeGreaterThan(0); } From 79f1369a0c7410781bb968821d32c0511884036b Mon Sep 17 00:00:00 2001 From: jonny-xhl Date: Wed, 9 Sep 2020 21:31:42 +0800 Subject: [PATCH 6/6] resolved conflicts --- .../Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs | 6 ++++++ 1 file changed, 6 insertions(+) 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 62c26d236d..f6ae630eda 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 @@ -212,6 +212,12 @@ namespace Volo.Abp.Identity.MongoDB .CountAsync(GetCancellationToken(cancellationToken)); } + public virtual Task RemoveAllRolesAsync(OrganizationUnit organizationUnit, CancellationToken cancellationToken = default) + { + organizationUnit.Roles.Clear(); + return Task.FromResult(0); + } + public virtual async Task RemoveAllMembersAsync(OrganizationUnit organizationUnit, CancellationToken cancellationToken = default) {