checkpointing - in the middle of the move towards xrn vs namespace
[sfa.git] / sfa / managers / registry_manager_pl.py
index f5f4b48..ac5901c 100644 (file)
@@ -1,14 +1,16 @@
 import types
 import time 
+
+from sfa.util.faults import *
 from sfa.util.prefixTree import prefixTree
 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.trust.credential import *
-from sfa.trust.certificate import *
-from sfa.util.faults import *
+from sfa.util.namespace import hrn_to_pl_login_base
+from sfa.util.xrn import Xrn, get_leaf, get_authority, hrn_to_urn, urn_to_hrn
+from sfa.trust.credential import Credential
+from sfa.trust.certificate import Certificate, Keypair
 from sfa.trust.gid import create_uuid
 
 def get_version(api):
@@ -66,6 +68,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))
@@ -158,7 +162,7 @@ def list(api, xrn, origin_hrn=None):
         record_list = registries[registry_hrn].list(credential, xrn, origin_hrn)
         records = [SfaRecord(dict=record).as_dict() for record in record_list]
     
-    # if we still havnt found the record yet, try the local registry
+    # if we still have not found the record yet, try the local registry
     if not records:
         if not api.auth.hierarchy.auth_exists(hrn):
             raise MissingAuthority(hrn)
@@ -364,12 +368,13 @@ def update(api, record_dict):
     
     return 1 
 
-def remove(api, xrn, type, origin_hrn=None):
-    # convert xrn to hrn     
-    if type:
-        hrn = urn_to_hrn(xrn)[0]
-    else:
-        hrn, type = urn_to_hrn(xrn)    
+# being PL specific it sounds right to expect a hrn+type (not a xrn)
+def remove(api, hrn, type, origin_hrn=None):
+#    # convert xrn to hrn     
+#    if type:
+#        hrn = urn_to_hrn(xrn)[0]
+#    else:
+#        hrn, type = urn_to_hrn(xrn)    
 
     table = SfaTable()
     filter = {'hrn': hrn}