diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs index 5675bf1fd4..d4a3f9aff3 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs @@ -58,6 +58,9 @@ namespace Volo.Abp.Identity bool includeDetails = false, Guid? roleId = null, Guid? organizationUnitId = null, + string userName = null, + string phoneNumber = null, + string emailAddress = null, CancellationToken cancellationToken = default ); @@ -90,6 +93,9 @@ namespace Volo.Abp.Identity string filter = null, Guid? roleId = null, Guid? organizationUnitId = null, + string userName = null, + string phoneNumber = null, + string emailAddress = null, CancellationToken cancellationToken = default ); } diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs index 01d1147372..bdb03591c1 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs @@ -138,6 +138,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore bool includeDetails = false, Guid? roleId = null, Guid? organizationUnitId = null, + string userName = null, + string phoneNumber = null, + string emailAddress = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) @@ -153,6 +156,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore ) .WhereIf(roleId.HasValue, identityUser => identityUser.Roles.Any(x => x.RoleId == roleId.Value)) .WhereIf(organizationUnitId.HasValue, identityUser => identityUser.OrganizationUnits.Any(x => x.OrganizationUnitId == organizationUnitId.Value)) + .WhereIf(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) + .WhereIf(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) + .WhereIf(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityUser.UserName) : sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); @@ -193,6 +199,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore string filter = null, Guid? roleId = null, Guid? organizationUnitId = null, + string userName = null, + string phoneNumber = null, + string emailAddress = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) @@ -207,6 +216,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore ) .WhereIf(roleId.HasValue, identityUser => identityUser.Roles.Any(x => x.RoleId == roleId.Value)) .WhereIf(organizationUnitId.HasValue, identityUser => identityUser.OrganizationUnits.Any(x => x.OrganizationUnitId == organizationUnitId.Value)) + .WhereIf(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) + .WhereIf(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) + .WhereIf(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) .LongCountAsync(GetCancellationToken(cancellationToken)); } diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs index 83181a6af8..318c0ae4ad 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs @@ -140,6 +140,9 @@ namespace Volo.Abp.Identity.MongoDB bool includeDetails = false, Guid? roleId = null, Guid? organizationUnitId = null, + string userName = null, + string phoneNumber = null, + string emailAddress = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) @@ -154,6 +157,9 @@ namespace Volo.Abp.Identity.MongoDB ) .WhereIf>(roleId.HasValue, identityUser => identityUser.Roles.Any(x => x.RoleId == roleId.Value)) .WhereIf>(organizationUnitId.HasValue, identityUser => identityUser.OrganizationUnits.Any(x => x.OrganizationUnitId == organizationUnitId.Value)) + .WhereIf>(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) + .WhereIf>(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) + .WhereIf>(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityUser.UserName) : sorting) .As>() .PageBy>(skipCount, maxResultCount) @@ -201,6 +207,9 @@ namespace Volo.Abp.Identity.MongoDB string filter = null, Guid? roleId = null, Guid? organizationUnitId = null, + string userName = null, + string phoneNumber = null, + string emailAddress = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) @@ -215,6 +224,9 @@ namespace Volo.Abp.Identity.MongoDB ) .WhereIf>(roleId.HasValue, identityUser => identityUser.Roles.Any(x => x.RoleId == roleId.Value)) .WhereIf>(organizationUnitId.HasValue, identityUser => identityUser.OrganizationUnits.Any(x => x.OrganizationUnitId == organizationUnitId.Value)) + .WhereIf>(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) + .WhereIf>(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) + .WhereIf>(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) .LongCountAsync(GetCancellationToken(cancellationToken)); }