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 d4a3f9aff3..37516c05a7 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 @@ -33,19 +33,19 @@ namespace Volo.Abp.Identity ); Task FindByNormalizedEmailAsync( - [NotNull] string normalizedEmail, + [NotNull] string normalizedEmail, bool includeDetails = true, CancellationToken cancellationToken = default ); Task> GetListByClaimAsync( - Claim claim, + Claim claim, bool includeDetails = false, CancellationToken cancellationToken = default ); Task> GetListByNormalizedRoleNameAsync( - string normalizedRoleName, + string normalizedRoleName, bool includeDetails = false, CancellationToken cancellationToken = default ); @@ -61,6 +61,8 @@ namespace Volo.Abp.Identity string userName = null, string phoneNumber = null, string emailAddress = null, + bool? isLockedOut = null, + bool? notActive = null, CancellationToken cancellationToken = default ); @@ -78,10 +80,10 @@ namespace Volo.Abp.Identity Task> GetUsersInOrganizationUnitAsync( Guid organizationUnitId, CancellationToken cancellationToken = default - ); - Task> GetUsersInOrganizationsListAsync( - List organizationUnitIds, - CancellationToken cancellationToken = default + ); + Task> GetUsersInOrganizationsListAsync( + List organizationUnitIds, + CancellationToken cancellationToken = default ); Task> GetUsersInOrganizationUnitWithChildrenAsync( @@ -96,6 +98,8 @@ namespace Volo.Abp.Identity string userName = null, string phoneNumber = null, string emailAddress = null, + bool? isLockedOut = null, + bool? notActive = 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 bdb03591c1..648c999624 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 @@ -141,6 +141,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore string userName = null, string phoneNumber = null, string emailAddress = null, + bool? isLockedOut = null, + bool? notActive = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) @@ -159,6 +161,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .WhereIf(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) .WhereIf(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) .WhereIf(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) + .WhereIf(isLockedOut == true, x => x.LockoutEnabled && x.LockoutEnd > DateTimeOffset.UtcNow) + .WhereIf(notActive == true, x => !x.IsActive) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityUser.UserName) : sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); @@ -202,6 +206,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore string userName = null, string phoneNumber = null, string emailAddress = null, + bool? isLockedOut = null, + bool? notActive = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) @@ -219,6 +225,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .WhereIf(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) .WhereIf(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) .WhereIf(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) + .WhereIf(isLockedOut == true, x => x.LockoutEnabled && x.LockoutEnd > DateTimeOffset.UtcNow) + .WhereIf(notActive == true, x => !x.IsActive) .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 318c0ae4ad..30a8c147aa 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 @@ -143,6 +143,8 @@ namespace Volo.Abp.Identity.MongoDB string userName = null, string phoneNumber = null, string emailAddress = null, + bool? isLockedOut = null, + bool? notActive = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) @@ -160,6 +162,8 @@ namespace Volo.Abp.Identity.MongoDB .WhereIf>(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) .WhereIf>(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) .WhereIf>(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) + .WhereIf>(isLockedOut == true, x => x.LockoutEnabled && x.LockoutEnd > DateTimeOffset.UtcNow) + .WhereIf>(notActive == true, x => !x.IsActive) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityUser.UserName) : sorting) .As>() .PageBy>(skipCount, maxResultCount) @@ -210,6 +214,8 @@ namespace Volo.Abp.Identity.MongoDB string userName = null, string phoneNumber = null, string emailAddress = null, + bool? isLockedOut = null, + bool? notActive = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) @@ -227,6 +233,8 @@ namespace Volo.Abp.Identity.MongoDB .WhereIf>(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) .WhereIf>(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) .WhereIf>(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) + .WhereIf>(isLockedOut == true, x => x.LockoutEnabled && x.LockoutEnd > DateTimeOffset.UtcNow) + .WhereIf>(notActive == true, x => !x.IsActive) .LongCountAsync(GetCancellationToken(cancellationToken)); }