public RoleManager(DistributorRole distributorPermission, string host, string user, string?impersonating, string?forwardedFor) { DistributorRole = distributorPermission; Host = host; User = user; Impersonating = string.IsNullOrWhiteSpace(impersonating) ? null : impersonating; ForwardedFor = string.IsNullOrWhiteSpace(forwardedFor) ? null : forwardedFor; }
public bool HasRole(string feed, Role role) { // Check the cache . if (!_feedDecision.TryGetValue(feed, out var roleDecision)) { _feedDecision.Add(feed, roleDecision = new Dictionary <Role, bool>()); } if (roleDecision.TryGetValue(role, out var decision)) { return(decision); } decision = DistributorRole.HasRole(HostForFeed(feed), UserForFeed(feed), feed, role); // Cache the decision; roleDecision.Add(role, decision); return(decision); }
public bool IsProxyAllowed(string feed) { return(DistributorRole.IsProxyAllowedForFeed(feed)); }
public bool IsImpersonationAllowed(string feed) { return(DistributorRole.IsImpersonationAllowedForFeed(feed)); }
public bool IsAuthorizationRequired(string feed) { return(DistributorRole.IsAuthorizationRequiredForFeed(feed)); }