Browse Source

Merge pull request #14597 from abpframework/saas-tenant-admin-password-12067

Set tenant admin's password from host side
pull/14603/head
Halil İbrahim Kalkan 3 years ago
committed by GitHub
parent
commit
f5a6d5b0be
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs
  2. 15
      modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs
  3. 14
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs

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

@ -102,4 +102,11 @@ public interface IIdentityUserRepository : IBasicRepository<IdentityUser, Guid>
bool? notActive = null, bool? notActive = null,
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
); );
Task<IdentityUser> FindByTenantIdAndUserNameAsync(
[NotNull] string userName,
Guid? tenantId,
bool includeDetails = true,
CancellationToken cancellationToken = default
);
} }

15
modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs

@ -5,6 +5,7 @@ using System.Linq.Dynamic.Core;
using System.Security.Claims; using System.Security.Claims;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
@ -301,4 +302,18 @@ public class EfCoreIdentityUserRepository : EfCoreRepository<IIdentityDbContext,
{ {
return (await GetQueryableAsync()).IncludeDetails(); return (await GetQueryableAsync()).IncludeDetails();
} }
public virtual async Task<IdentityUser> FindByTenantIdAndUserNameAsync(
[NotNull] string userName,
Guid? tenantId,
bool includeDetails = true,
CancellationToken cancellationToken = default)
{
return await(await GetDbSetAsync())
.IncludeDetails(includeDetails)
.FirstOrDefaultAsync(
u => u.TenantId == tenantId && u.UserName == userName,
GetCancellationToken(cancellationToken)
);
}
} }

14
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs

@ -5,6 +5,7 @@ using System.Linq.Dynamic.Core;
using System.Security.Claims; using System.Security.Claims;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using JetBrains.Annotations;
using MongoDB.Driver; using MongoDB.Driver;
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.Domain.Repositories.MongoDB;
@ -269,4 +270,17 @@ public class MongoIdentityUserRepository : MongoDbRepository<IAbpIdentityMongoDb
.Where(u => u.OrganizationUnits.Any(uou => organizationUnitIds.Contains(uou.OrganizationUnitId))) .Where(u => u.OrganizationUnits.Any(uou => organizationUnitIds.Contains(uou.OrganizationUnitId)))
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
} }
public virtual async Task<IdentityUser> FindByTenantIdAndUserNameAsync(
[NotNull] string userName,
Guid? tenantId,
bool includeDetails = true,
CancellationToken cancellationToken = default)
{
return await (await GetMongoQueryableAsync(cancellationToken))
.FirstOrDefaultAsync(
u => u.TenantId == tenantId && u.UserName == userName,
GetCancellationToken(cancellationToken)
);
}
} }

Loading…
Cancel
Save