Ignore:
Timestamp:
Dec 1, 2008 3:07:40 PM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
Children:
f816079
Parents:
f069052
Message:

All services use authorizer. Global authorization file, shared routine to read simple authorization files. Fixes some more partial state errors in experiment_control.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/fedd/authorizer.py

    rf069052 r05191a6  
    1414    def __init__(self, def_attr="testbed"):
    1515        self.attrs = { }
     16        self.globals=set()
    1617
    1718    @staticmethod
     
    8687    def check_attribute(self, name, attr):
    8788        """
    88         Return True if name has attr.  Tuple names match any tuple name that
    89         matches all names present and has None entries in other fileds.  For
    90         tuple names True implies that there is a matching tuple name with the
    91         attribute.
     89        Return True if name has attr (or if attr is global).  Tuple names match
     90        any tuple name that matches all names present and has None entries in
     91        other fileds.  For tuple names True implies that there is a matching
     92        tuple name with the attribute.
    9293        """
    9394        def tup(tup, i, p):
     
    9798
    9899        self.valid_name(name)
     100        if attr in self.globals:
     101            return True
    99102
    100103        if isinstance(name, tuple):
     
    107110            return  attr in self.attrs.get(self.auth_name(name), set())
    108111
     112    def set_global_attribute(self, attr):
     113        """
     114        Set a global attribute.  All names, even those otherwise unknown to the
     115        authorizer have this attribute.
     116        """
     117        self.globals.add(attr)
    109118
     119    def unset_global_attribute(self, attr):
     120        """
     121        Remove a global attribute
     122        """
     123
     124        self.globals.discard(attr)
     125
Note: See TracChangeset for help on using the changeset viewer.