Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public bool IsProxyAllowed(string feed)
 {
     return(DistributorRole.IsProxyAllowedForFeed(feed));
 }
Exemplo n.º 4
0
 public bool IsImpersonationAllowed(string feed)
 {
     return(DistributorRole.IsImpersonationAllowedForFeed(feed));
 }
Exemplo n.º 5
0
 public bool IsAuthorizationRequired(string feed)
 {
     return(DistributorRole.IsAuthorizationRequiredForFeed(feed));
 }