public virtual async Task AddClaimAsync(Guid id, IdentityUserClaimCreateDto input)
        {
            var user = await UserManager.GetByIdAsync(id);

            var claim = new Claim(input.ClaimType, input.ClaimValue);

            if (user.FindClaim(claim) != null)
            {
                throw new UserFriendlyException(L["UserClaimAlreadyExists"]);
            }
            user.AddClaim(GuidGenerator, claim);
            (await UserManager.UpdateAsync(user)).CheckErrors();

            await CurrentUnitOfWork.SaveChangesAsync();
        }
예제 #2
0
 public virtual async Task AddClaimAsync(Guid id, IdentityUserClaimCreateDto input)
 {
     await UserAppService.AddClaimAsync(id, input);
 }