Browse Source

Add `isLockedOut` and `isActive` to `IIdentityUserRepository`.

pull/10501/head
maliming 5 years ago
parent
commit
4e169cedbb
No known key found for this signature in database GPG Key ID: 96224957E51C89E
  1. 18
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs
  2. 8
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs
  3. 8
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs

18
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs

@ -33,19 +33,19 @@ namespace Volo.Abp.Identity
); );
Task<IdentityUser> FindByNormalizedEmailAsync( Task<IdentityUser> FindByNormalizedEmailAsync(
[NotNull] string normalizedEmail, [NotNull] string normalizedEmail,
bool includeDetails = true, bool includeDetails = true,
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
); );
Task<List<IdentityUser>> GetListByClaimAsync( Task<List<IdentityUser>> GetListByClaimAsync(
Claim claim, Claim claim,
bool includeDetails = false, bool includeDetails = false,
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
); );
Task<List<IdentityUser>> GetListByNormalizedRoleNameAsync( Task<List<IdentityUser>> GetListByNormalizedRoleNameAsync(
string normalizedRoleName, string normalizedRoleName,
bool includeDetails = false, bool includeDetails = false,
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
); );
@ -61,6 +61,8 @@ namespace Volo.Abp.Identity
string userName = null, string userName = null,
string phoneNumber = null, string phoneNumber = null,
string emailAddress = null, string emailAddress = null,
bool? isLockedOut = null,
bool? isActive = null,
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
); );
@ -78,10 +80,10 @@ namespace Volo.Abp.Identity
Task<List<IdentityUser>> GetUsersInOrganizationUnitAsync( Task<List<IdentityUser>> GetUsersInOrganizationUnitAsync(
Guid organizationUnitId, Guid organizationUnitId,
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
); );
Task<List<IdentityUser>> GetUsersInOrganizationsListAsync( Task<List<IdentityUser>> GetUsersInOrganizationsListAsync(
List<Guid> organizationUnitIds, List<Guid> organizationUnitIds,
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
); );
Task<List<IdentityUser>> GetUsersInOrganizationUnitWithChildrenAsync( Task<List<IdentityUser>> GetUsersInOrganizationUnitWithChildrenAsync(
@ -96,6 +98,8 @@ namespace Volo.Abp.Identity
string userName = null, string userName = null,
string phoneNumber = null, string phoneNumber = null,
string emailAddress = null, string emailAddress = null,
bool? isLockedOut = null,
bool? isActive = null,
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
); );
} }

8
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 userName = null,
string phoneNumber = null, string phoneNumber = null,
string emailAddress = null, string emailAddress = null,
bool? isLockedOut = null,
bool? isActive = null,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await (await GetDbSetAsync()) return await (await GetDbSetAsync())
@ -159,6 +161,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
.WhereIf(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) .WhereIf(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName)
.WhereIf(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) .WhereIf(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber)
.WhereIf(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) .WhereIf(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress)
.WhereIf(isLockedOut == true, x => x.LockoutEnabled && x.LockoutEnd > DateTimeOffset.UtcNow)
.WhereIf(isActive == true, x => x.IsActive == isActive)
.OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityUser.UserName) : sorting) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityUser.UserName) : sorting)
.PageBy(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
@ -202,6 +206,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
string userName = null, string userName = null,
string phoneNumber = null, string phoneNumber = null,
string emailAddress = null, string emailAddress = null,
bool? isLockedOut = null,
bool? isActive = null,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await (await GetDbSetAsync()) return await (await GetDbSetAsync())
@ -219,6 +225,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore
.WhereIf(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) .WhereIf(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName)
.WhereIf(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) .WhereIf(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber)
.WhereIf(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) .WhereIf(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress)
.WhereIf(isLockedOut == true, x => x.LockoutEnabled && x.LockoutEnd > DateTimeOffset.UtcNow)
.WhereIf(isActive == true, x => x.IsActive == isActive)
.LongCountAsync(GetCancellationToken(cancellationToken)); .LongCountAsync(GetCancellationToken(cancellationToken));
} }

8
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 userName = null,
string phoneNumber = null, string phoneNumber = null,
string emailAddress = null, string emailAddress = null,
bool? isLockedOut = null,
bool? isActive = null,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
@ -160,6 +162,8 @@ namespace Volo.Abp.Identity.MongoDB
.WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) .WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName)
.WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) .WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber)
.WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) .WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress)
.WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(isLockedOut == true, x => x.LockoutEnabled && x.LockoutEnd > DateTimeOffset.UtcNow)
.WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(isActive == true, x => x.IsActive == isActive)
.OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityUser.UserName) : sorting) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityUser.UserName) : sorting)
.As<IMongoQueryable<IdentityUser>>() .As<IMongoQueryable<IdentityUser>>()
.PageBy<IdentityUser, IMongoQueryable<IdentityUser>>(skipCount, maxResultCount) .PageBy<IdentityUser, IMongoQueryable<IdentityUser>>(skipCount, maxResultCount)
@ -210,6 +214,8 @@ namespace Volo.Abp.Identity.MongoDB
string userName = null, string userName = null,
string phoneNumber = null, string phoneNumber = null,
string emailAddress = null, string emailAddress = null,
bool? isLockedOut = null,
bool? isActive = null,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
@ -227,6 +233,8 @@ namespace Volo.Abp.Identity.MongoDB
.WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) .WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName)
.WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) .WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber)
.WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) .WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress)
.WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(isLockedOut == true, x => x.LockoutEnabled && x.LockoutEnd > DateTimeOffset.UtcNow)
.WhereIf<IdentityUser, IMongoQueryable<IdentityUser>>(isActive == true, x => x.IsActive == isActive)
.LongCountAsync(GetCancellationToken(cancellationToken)); .LongCountAsync(GetCancellationToken(cancellationToken));
} }

Loading…
Cancel
Save