private void AddStrategiesForResourceClaimLineage(List <ResourceClaimActionAuthorization> strategies, string resourceClaimUri, string action) { //check for exact match on resource and action var claimAndStrategy = ResourceClaimAuthorizationMetadata .SingleOrDefault( rcas => rcas.ResourceClaim.ClaimName.Equals(resourceClaimUri, StringComparison.InvariantCultureIgnoreCase) && rcas.Action.ActionUri.Equals(action, StringComparison.InvariantCultureIgnoreCase)); // Add the claim/strategy if it was found if (claimAndStrategy != null) { strategies.Add(claimAndStrategy); } var resourceClaim = ResourceClaims.FirstOrDefault(rc => rc.ClaimName.Equals(resourceClaimUri, StringComparison.InvariantCultureIgnoreCase)); // if there's a parent resource, recurse if (resourceClaim != null && resourceClaim.ParentResourceClaim != null) { AddStrategiesForResourceClaimLineage(strategies, resourceClaim.ParentResourceClaim.ClaimName, action); } }
public virtual ResourceClaim GetResourceByResourceName(string resourceName) { return(ResourceClaims.FirstOrDefault(rc => rc.ResourceName.Equals(resourceName, StringComparison.InvariantCultureIgnoreCase))); }