X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmanagers%2Fregistry_manager_pl.py;h=f71915e7fa5e53a7e6e70a27166b33eddd4d96d8;hb=99e9f96209b9ebfd1853e7b8902a1a0fe893eaa2;hp=50776c0c8f112e0244d0c4725ac0dac0ac09bccd;hpb=952322d76247f8991f3c2688ed7e1f5a22ca4572;p=sfa.git diff --git a/sfa/managers/registry_manager_pl.py b/sfa/managers/registry_manager_pl.py index 50776c0c..f71915e7 100644 --- a/sfa/managers/registry_manager_pl.py +++ b/sfa/managers/registry_manager_pl.py @@ -5,12 +5,17 @@ from sfa.util.record import SfaRecord from sfa.util.table import SfaTable from sfa.util.record import SfaRecord from sfa.trust.gid import GID -from sfa.util.namespace import * +from sfa.util.namespace import get_leaf, get_authority, hrn_to_urn, hrn_to_pl_login_base, urn_to_hrn from sfa.trust.credential import * from sfa.trust.certificate import * from sfa.util.faults import * +from sfa.trust.gid import create_uuid - +def get_version(api): + version = {} + version['geni_api'] = 1 + version['sfa'] = 1 + return version def get_credential(api, xrn, type, is_self=False): # convert xrn to hrn @@ -61,6 +66,8 @@ def get_credential(api, xrn, type, is_self=False): #new_cred.set_pubkey(object_gid.get_pubkey()) new_cred.set_privileges(rights) new_cred.get_privileges().delegate_all_privileges(True) + if 'expires' in record: + new_cred.set_expiration(int(record['expires'])) auth_kind = "authority,ma,sa" # Parent not necessary, verify with certs #new_cred.set_parent(api.auth.hierarchy.get_auth_cred(auth_hrn, kind=auth_kind)) @@ -76,24 +83,7 @@ def GetVersion(): version['geni_api'] = 1 return version - - -# The GENI resolve call -def Resolve(api, xrn, creds): - records = resolve(api, xrn) - - if len(records) == 0: - return {} - - record = records[0] - if record.type == 'slice': - return {'geni_urn': xrn, 'geni_creator': " ".join(record.PI)} - if record.type == 'user': - return {'geni_urn': xrn, 'geni_certificate': record.gid} - - - -def resolve(api, xrns, type=None, origin_hrn=None, full=True): +def resolve(api, xrns, type=None, full=True): # load all know registry names into a prefix tree and attempt to find # the longest matching prefix @@ -125,7 +115,7 @@ def resolve(api, xrns, type=None, origin_hrn=None, full=True): xrns = xrn_dict[registry_hrn] if registry_hrn != api.hrn: credential = api.getCredential() - peer_records = registries[registry_hrn].resolve(credential, xrns, origin_hrn) + peer_records = registries[registry_hrn].Resolve(xrns, credential) records.extend([SfaRecord(dict=record).as_dict() for record in peer_records]) # try resolving the remaining unfound records at the local registry @@ -385,7 +375,7 @@ def remove(api, xrn, type, origin_hrn=None): table = SfaTable() filter = {'hrn': hrn} - if type not in ['all', '*']: + if type and type not in ['all', '*']: filter['type'] = type records = table.find(filter) if not records: