4 from sfa.util.faults import *
5 from sfa.util.namespace import *
6 from sfa.util.method import Method
7 from sfa.util.parameter import Parameter, Mixed
8 from sfa.util.record import SfaRecord
9 from sfa.trust.credential import Credential
13 List the records in an authority.
15 @param cred credential string specifying the rights of the caller
16 @param hrn human readable name of authority to list (hrn or urn)
17 @return list of record dictionaries
19 interfaces = ['registry']
22 Parameter(str, "Credential string"),
23 Parameter(str, "Human readable name (hrn or urn)"),
24 Mixed(Parameter(str, "Human readable name of the original caller"),
25 Parameter(None, "Origin hrn not specified"))
30 def call(self, cred, xrn, origin_hrn=None):
31 hrn, type = urn_to_hrn(xrn)
32 user_cred = Credential(string=cred)
35 origin_hrn = user_cred.get_gid_caller().get_hrn()
36 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name))
39 self.api.auth.check(cred, 'list')
41 # send the call to the right manager
42 manager_base = 'sfa.managers'
43 mgr_type = self.api.config.SFA_REGISTRY_TYPE
44 manager_module = manager_base + ".registry_manager_%s" % mgr_type
45 manager = __import__(manager_module, fromlist=[manager_base])
46 return manager.list(self.api, xrn, origin_hrn)