Changeset 2628e5d for fedd/federation


Ignore:
Timestamp:
Sep 22, 2010 5:54:11 PM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master
Children:
dc3a11e
Parents:
d39809f
Message:

Slight rearrangement, add a call to initialize the library and the loadfile
parameter for initialization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/authorizer.py

    rd39809f r2628e5d  
    185185    clean_attr_re = re.compile('[^A-Za-z_]+')
    186186    cred_file_re = re.compile('.*\.der$')
    187 
    188     def __init__(self, certs=None, me=None, key=None):
     187    ABAC.libabac_init()
     188
     189    def __init__(self, certs=None, me=None, key=None, loadfile=None):
    189190        self.bad_name = authorizer_base.bad_name
    190191        self.attribute_error = authorizer_base.attribute_error
     192        self.creddy = '/usr/local/bin/creddy'
    191193        self.globals = set()
    192         self.creddy = '/usr/local/bin/creddy'
     194        self.lock = Lock()
    193195        self.me = me
    194196        self.key = key
    195197        self.context = ABAC.Context()
    196         self.lock = Lock()
    197 
    198198        if me:
    199199            self.fedid = fedid(file=self.me)
    200200            self.context.load_id_file(self.me)
    201201
     202        if isinstance(certs, basestring):
     203            certs = [ certs ]
     204
    202205        for dir in certs or []:
    203206            self.context.load_directory(dir)
     207
     208        if loadfile:
     209            self.load(loadfile)
    204210
    205211    @staticmethod
    206212    def clean_attr(attr):
    207213        return abac_authorizer.clean_attr_re.sub('_', attr)
    208 
    209214
    210215    def set_attribute(self, name=None, attr=None, cert=None):
Note: See TracChangeset for help on using the changeset viewer.