コード例 #1
0
        public async Task <ActionResult> GroupSecurityClaimAdd(string claimType, string claimValue, string groupId)
        {
            var identityResult = new IdentityResult();

            var groupClaims = await _groupManager.GetGroupClaimsAsync(groupId, claimType);

            if (!groupClaims.Any(x => x.ClaimType == claimType && x.ClaimValue == claimValue))
            {
                identityResult = await _groupManager.AddClaimAsync(groupId, new Claim(claimType, claimValue), "Permission");
            }

            return(Ok(identityResult));
        }