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