2 from sfa.util.xrn import urn_to_hrn
3 from sfa.util.method import Method
5 from sfa.trust.credential import Credential
7 from sfa.storage.parameter import Parameter, Mixed
11 List the records in an authority.
13 @param cred credential string specifying the rights of the caller
14 @param hrn human readable name of authority to list (hrn or urn)
15 @return list of record dictionaries
17 interfaces = ['registry']
20 Parameter(str, "Human readable name (hrn or urn)"),
21 Mixed(Parameter(str, "Credential string"),
22 Parameter(type([str]), "List of credentials")),
25 # xxx used to be [SfaRecord]
26 returns = [Parameter(dict, "registry record")]
28 def call(self, xrn, creds, options=None):
29 if options is None: options={}
30 hrn, type = urn_to_hrn(xrn)
31 valid_creds = self.api.auth.checkCredentials(creds, 'list')
34 origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
35 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name))
37 return self.api.manager.List(self.api, xrn, options=options)