1 ### $Id: reset_slices.py 15428 2009-10-23 15:28:03Z tmack $
2 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/reset_slices.py $
4 from sfa.util.faults import *
5 from sfa.util.misc import *
6 from sfa.util.method import Method
7 from sfa.util.parameter import Parameter, Mixed
8 from sfa.trust.auth import Auth
10 class get_trusted_certs(Method):
12 @param cred credential string specifying the rights of the caller
13 @param request_hash hash of the request
14 @return 1 is successful, faults otherwise
17 interfaces = ['registry']
20 Parameter(str, "Credential string"),
21 Mixed(Parameter(str, "Request hash"),
22 Parameter(None, "Request hash not specified"))
25 returns = Parameter(int, "1 if successful")
27 def call(self, cred, request_hash=None):
28 # authenticate the cred
29 client_gid = Credential(string=cred).get_gid_caller()
30 client_gid_str = client_gid.save_to_string(save_parents=True)
31 self.api.auth.authenticateGid(client_gid_str, [cred, hrn], request_hash)
32 self.api.auth.check(cred, 'gettrustedcerts')
34 trusted_cert_strings = [gid.save_to_string(save_parents=True) for \
35 gid in self.api.auth.trusted_cert_list]
37 return trusted_cert_strings