From 9179326f7462c5521bb3921b2e41b9863b895cb2 Mon Sep 17 00:00:00 2001
From: Josh Karlin <jkarlin@bbn.com>
Date: Thu, 25 Mar 2010 16:49:34 +0000
Subject: [PATCH] Patched up Credentials to work with the new Certificates

---
 sfa/client/sfi.py       | 2 +-
 sfa/trust/credential.py | 8 +++++---
 sfa/trust/rights.py     | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/sfa/client/sfi.py b/sfa/client/sfi.py
index d2fb9302..27192dfe 100755
--- a/sfa/client/sfi.py
+++ b/sfa/client/sfi.py
@@ -911,7 +911,7 @@ class Sfi:
         user_cred = self.get_user_cred().save_to_string(save_parents=True)
         server = self.geni_am
         call_options = {}
-        return server.ListResources([user_cred], call_options)
+        print server.ListResources([user_cred], call_options)
         
     
     #
diff --git a/sfa/trust/credential.py b/sfa/trust/credential.py
index d8451d74..0bdc07de 100644
--- a/sfa/trust/credential.py
+++ b/sfa/trust/credential.py
@@ -14,6 +14,7 @@ from sfa.trust.certificate import Certificate
 from sfa.trust.rights import *
 from sfa.trust.gid import *
 from sfa.util.faults import *
+from sfa.util.sfalogging import *
 
 ##
 # Credential is a tuple:
@@ -156,7 +157,7 @@ class Credential(Certificate):
         if self.privileges:
             dict["privileges"] = self.privileges.save_to_string()
         str = xmlrpclib.dumps((dict,), allow_none=True)
-        self.set_data(str)
+        self.set_data('URI:http://' + str)
 
     ##
     # Retrieve the attributes of the credential from the alt-subject-name field
@@ -164,9 +165,10 @@ class Credential(Certificate):
     # get_* methods of this class and should not need to be called explicitly.
 
     def decode(self):
-        data = self.get_data()
+        data = self.get_data().lstrip('URI:http://')
+        
         if data:
-            dict = xmlrpclib.loads(self.get_data())[0][0]
+            dict = xmlrpclib.loads(data)[0][0]
         else:
             dict = {}
 
diff --git a/sfa/trust/rights.py b/sfa/trust/rights.py
index 6d7fc85b..ab99b44f 100644
--- a/sfa/trust/rights.py
+++ b/sfa/trust/rights.py
@@ -16,7 +16,7 @@
 
 privilege_table = {"authority": ["register", "remove", "update", "resolve", "list", "getcredential", "*"],
                    "refresh": ["remove", "update"],
-                   "resolve": ["resolve", "list", "getcredential"],
+                   "resolve": ["resolve", "list", "getcredential", "listresources", "getversion"],
                    "sa": ["getticket", "redeemslice", "redeemticket", "createslice", "deleteslice", "updateslice", 
                           "getsliceresources", "getticket", "loanresources", "stopslice", "startslice", 
                           "deleteslice", "resetslice", "listslices", "listnodes", "getpolicy"],
-- 
2.47.0