コード例 #1
0
        public override bool Matches(Claim c)
        {
            if (c.Type != ClaimType)
            {
                return(false);
            }
            var cv = ApplicationPermissionClaimValue.Load(c.Value);

            return(cv != null && cv.ApplicationPermissionName.ToString() == PermissionName);
        }
コード例 #2
0
        public static List <AspnetUserApplicationPermissionClaim> GenerateData(List <AspNetUserClaim> claims)
        {
            var viewList = new List <AspnetUserApplicationPermissionClaim>();

            foreach (var claim in claims)
            {
                var loadedClaim = ApplicationPermissionClaimValue.Load(claim.ClaimValue);
                foreach (var loadedClaimRegion in loadedClaim.Regions)
                {
                    viewList.Add(new AspnetUserApplicationPermissionClaim
                    {
                        PermissionName = Enum.GetName(typeof(ApplicationPermissionNames), loadedClaim.ApplicationPermissionName),
                        Region         = loadedClaimRegion,
                        UserId         = claim.UserId
                    });
                }
            }
            return(viewList);
        }