+#----------------------------------------------------------------------
+# Copyright (c) 2008 Board of Trustees, Princeton University
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and/or hardware specification (the "Work") to
+# deal in the Work without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Work, and to permit persons to whom the Work
+# is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Work.
+#
+# THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS
+# IN THE WORK.
+#----------------------------------------------------------------------
#
# implements SFA tickets
#
-import xmlrpclib
+
from sfa.trust.certificate import Certificate
-from sfa.trust.rights import *
-from sfa.trust.gid import *
+from sfa.trust.gid import GID
+
+import xmlrpc.client
# Ticket is tuple:
# (gidCaller, gidObject, attributes, rspec, delegate)
# attributes = slice attributes (keys, vref, instantiation, etc)
# rspec = resources
+
class SfaTicket(Certificate):
gidCaller = None
gidObject = None
"rspec": self.rspec,
"delegate": self.delegate}
if self.gidCaller:
- dict["gidCaller"] = self.gidCaller.save_to_string(save_parents=True)
+ dict["gidCaller"] = self.gidCaller.save_to_string(
+ save_parents=True)
if self.gidObject:
- dict["gidObject"] = self.gidObject.save_to_string(save_parents=True)
- str = "URI:" + xmlrpclib.dumps((dict,), allow_none=True)
+ dict["gidObject"] = self.gidObject.save_to_string(
+ save_parents=True)
+ str = "URI:" + xmlrpc.client.dumps((dict,), allow_none=True)
self.set_data(str)
def decode(self):
data = self.get_data()
if data:
- dict = xmlrpclib.loads(self.get_data()[4:])[0][0]
+ dict = xmlrpc.client.loads(self.get_data()[4:])[0][0]
else:
dict = {}
self.gidObject = None
def dump(self, dump_parents=False):
- print "TICKET", self.get_subject()
+ print("TICKET", self.get_subject())
- print " gidCaller:"
+ print(" gidCaller:")
gidCaller = self.get_gid_caller()
if gidCaller:
gidCaller.dump(8, dump_parents)
- print " gidObject:"
+ print(" gidObject:")
gidObject = self.get_gid_object()
if gidObject:
gidObject.dump(8, dump_parents)
- print " attributes:"
- for attrname in self.get_attributes().keys():
- print " ", attrname, self.get_attributes()[attrname]
+ print(" attributes:")
+ for attrname in list(self.get_attributes().keys()):
+ print(" ", attrname, self.get_attributes()[attrname])
- print " rspec:"
- print " ", self.get_rspec()
+ print(" rspec:")
+ print(" ", self.get_rspec())
if self.parent and dump_parents:
- print "PARENT",
- self.parent.dump(dump_parents)
+ print("PARENT", end=' ')
+ self.parent.dump(dump_parents)