trimmed useless imports, unstarred all imports
[sfa.git] / sfa / methods / RedeemTicket.py
1 from sfa.util.method import Method
2 from sfa.util.parameter import Parameter, Mixed
3
4 class RedeemTicket(Method):
5     """
6
7     @param cred credential string specifying the rights of the caller
8     @param ticket 
9     @return 1 is successful, faults otherwise  
10     """
11
12     interfaces = ['component']
13     
14     accepts = [
15         Parameter(str, "Ticket  string representation of SFA ticket"),
16         Mixed(Parameter(str, "Credential string"),
17               Parameter(type([str]), "List of credentials")),
18         ]
19
20     returns = [Parameter(int, "1 if successful")]
21     
22     def call(self, ticket, creds):
23         valid_creds = self.api.auth.checkCredentials(cred, 'redeemticket')
24         self.api.auth.check_ticket(ticket)
25
26         
27         # send the call to the right manager
28         manager = self.api.get_interface_manager()
29         manager.redeem_ticket(self.api, ticket) 
30         return 1