コード例 #1
0
        public virtual async Task AddClaimAsync(Guid id, IdentityRoleClaimCreateDto input)
        {
            var role = await IdentityRoleRepository.GetAsync(id);

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

            if (role.FindClaim(claim) != null)
            {
                throw new UserFriendlyException(L["RoleClaimAlreadyExists"]);
            }

            role.AddClaim(GuidGenerator, claim);
            await IdentityRoleRepository.UpdateAsync(role);

            await CurrentUnitOfWork.SaveChangesAsync();
        }
コード例 #2
0
 public virtual async Task AddClaimAsync(Guid id, IdentityRoleClaimCreateDto input)
 {
     await RoleAppService.AddClaimAsync(id, input);
 }