remove request_hash argument
[sfa.git] / sfa / methods / get_trusted_certs.py
1
2 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/reset_slices.py $
3
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
9 from sfa.trust.credential import Credential
10
11 class get_trusted_certs(Method):
12     """
13     @param cred credential string specifying the rights of the caller
14     @return 1 is successful, faults otherwise  
15     """
16
17     interfaces = ['registry']
18     
19     accepts = [
20         Parameter(str, "Credential string")
21         ]
22
23     returns = Parameter(int, "1 if successful")
24     
25     def call(self, cred):
26         # authenticate the cred
27         self.api.auth.check(cred, 'gettrustedcerts')
28
29         trusted_cert_strings = [gid.save_to_string(save_parents=True) for \
30                                 gid in self.api.auth.trusted_cert_list] 
31         
32         return trusted_cert_strings