1 from geni.util.faults import *
2 from geni.util.excep import *
3 from geni.util.method import Method
4 from geni.util.parameter import Parameter, Mixed
5 from geni.util.auth import Auth
6 from geni.util.record import GeniRecord
7 from geni.registry import Registries
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
15 @return list of record dictionaries
18 interfaces = ['registry']
21 Parameter(str, "Credential string"),
22 Parameter(str, "Human readable name (hrn)")
25 returns = [GeniRecord]
27 def call(self, cred, hrn):
29 self.api.auth.check(cred, 'list')
32 if not self.api.auth.hierarchy.auth_exists(hrn):
33 raise MissingAuthority(hrn)
34 table = self.api.auth.get_auth_table(hrn)
35 records = table.list()
36 except MissingAuthority:
37 # is this a foreign authority
38 registries = Registries(self.api)
39 credential = self.api.getCredential()
40 for registry in registries:
41 if hrn.startswith(registry) and registry not in [self.api.hrn]:
42 records = registries[registry].list(credential, hrn)