|
|
|
@ -291,7 +291,7 @@ namespace Volo.Abp.Identity
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="user">The user to retrieve the password hash for.</param>
|
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
|
|
|
|
|
/// <returns>A <see cref="Task{TResult}"/> containing a flag indicating if the specified user has a password. If the
|
|
|
|
|
/// <returns>A <see cref="Task{TResult}"/> containing a flag indicating if the specified user has a password. If the
|
|
|
|
|
/// user has a password the returned value with be true, otherwise it will be false.</returns>
|
|
|
|
|
public virtual Task<bool> HasPasswordAsync([NotNull] IdentityUser user, CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
@ -326,7 +326,7 @@ namespace Volo.Abp.Identity
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Role {0} does not exist!", normalizedRoleName));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await UserRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken);
|
|
|
|
|
|
|
|
|
|
user.AddRole(role.Id);
|
|
|
|
@ -353,7 +353,7 @@ namespace Volo.Abp.Identity
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await UserRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
user.RemoveRole(role.Id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -384,15 +384,15 @@ namespace Volo.Abp.Identity
|
|
|
|
|
/// <param name="user">The user whose role membership should be checked.</param>
|
|
|
|
|
/// <param name="normalizedRoleName">The role to check membership of</param>
|
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
|
|
|
|
|
/// <returns>A <see cref="Task{TResult}"/> containing a flag indicating if the specified user is a member of the given group. If the
|
|
|
|
|
/// <returns>A <see cref="Task{TResult}"/> containing a flag indicating if the specified user is a member of the given group. If the
|
|
|
|
|
/// user is a member of the group the returned value with be true, otherwise it will be false.</returns>
|
|
|
|
|
public virtual async Task<bool> IsInRoleAsync(
|
|
|
|
|
[NotNull] IdentityUser user,
|
|
|
|
|
[NotNull] IdentityUser user,
|
|
|
|
|
[NotNull] string normalizedRoleName,
|
|
|
|
|
CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|
cancellationToken.ThrowIfCancellationRequested();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Check.NotNull(user, nameof(user));
|
|
|
|
|
Check.NotNullOrWhiteSpace(normalizedRoleName, nameof(normalizedRoleName));
|
|
|
|
|
|
|
|
|
@ -589,7 +589,7 @@ namespace Volo.Abp.Identity
|
|
|
|
|
|
|
|
|
|
Check.NotNull(user, nameof(user));
|
|
|
|
|
|
|
|
|
|
user.EmailConfirmed = confirmed;
|
|
|
|
|
user.SetEmailConfirmed(confirmed);
|
|
|
|
|
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
@ -864,7 +864,7 @@ namespace Volo.Abp.Identity
|
|
|
|
|
|
|
|
|
|
Check.NotNull(user, nameof(user));
|
|
|
|
|
|
|
|
|
|
user.PhoneNumberConfirmed = confirmed;
|
|
|
|
|
user.SetPhoneNumberConfirmed(confirmed);
|
|
|
|
|
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
@ -928,7 +928,7 @@ namespace Volo.Abp.Identity
|
|
|
|
|
/// <param name="user">The user whose two factor authentication enabled status should be set.</param>
|
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
|
|
|
|
|
/// <returns>
|
|
|
|
|
/// The <see cref="Task"/> that represents the asynchronous operation, containing a flag indicating whether the specified
|
|
|
|
|
/// The <see cref="Task"/> that represents the asynchronous operation, containing a flag indicating whether the specified
|
|
|
|
|
/// <paramref name="user"/> has two factor authentication enabled or not.
|
|
|
|
|
/// </returns>
|
|
|
|
|
public virtual Task<bool> GetTwoFactorEnabledAsync([NotNull] IdentityUser user, CancellationToken cancellationToken = default)
|
|
|
|
@ -946,7 +946,7 @@ namespace Volo.Abp.Identity
|
|
|
|
|
/// <param name="claim">The claim whose users should be retrieved.</param>
|
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
|
|
|
|
|
/// <returns>
|
|
|
|
|
/// The <see cref="Task"/> contains a list of users, if any, that contain the specified claim.
|
|
|
|
|
/// The <see cref="Task"/> contains a list of users, if any, that contain the specified claim.
|
|
|
|
|
/// </returns>
|
|
|
|
|
public virtual async Task<IList<IdentityUser>> GetUsersForClaimAsync([NotNull] Claim claim, CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
@ -963,7 +963,7 @@ namespace Volo.Abp.Identity
|
|
|
|
|
/// <param name="normalizedRoleName">The role whose users should be retrieved.</param>
|
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
|
|
|
|
|
/// <returns>
|
|
|
|
|
/// The <see cref="Task"/> contains a list of users, if any, that are in the specified role.
|
|
|
|
|
/// The <see cref="Task"/> contains a list of users, if any, that are in the specified role.
|
|
|
|
|
/// </returns>
|
|
|
|
|
public virtual async Task<IList<IdentityUser>> GetUsersInRoleAsync([NotNull] string normalizedRoleName, CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|