X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=blobdiff_plain;f=sfa%2Fmethods%2FGetGids.py;h=1e2349f868968a89b1033e2d10934557ee2ecae9;hp=601db6f67dfc1580e193c88a082d92ced8e54e64;hb=HEAD;hpb=2b3c0c7ebe7c55afb14e3ea3aed10f8b1abe01e7 diff --git a/sfa/methods/GetGids.py b/sfa/methods/GetGids.py index 601db6f6..1e2349f8 100644 --- a/sfa/methods/GetGids.py +++ b/sfa/methods/GetGids.py @@ -1,8 +1,11 @@ from sfa.util.faults import RecordNotFound from sfa.util.method import Method -from sfa.util.parameter import Parameter, Mixed + from sfa.trust.credential import Credential +from sfa.storage.parameter import Parameter, Mixed + + class GetGids(Method): """ Get a list of record information (hrn, gid and type) for @@ -14,30 +17,31 @@ class GetGids(Method): """ interfaces = ['registry'] - + accepts = [ - Mixed(Parameter(str, "Human readable name (hrn or xrn)"), + Mixed(Parameter(str, "Human readable name (hrn or xrn)"), Parameter(type([str]), "List of Human readable names (hrn or xrn)")), Mixed(Parameter(str, "Credential string"), - Parameter(type([str]), "List of credentials")), - ] + Parameter(type([str]), "List of credentials")), + ] returns = [Parameter(dict, "Dictionary of gids keyed on hrn")] - + def call(self, xrns, creds): # validate the credential valid_creds = self.api.auth.checkCredentials(creds, 'getgids') # xxxpylintxxx origin_hrn is unused.. - origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn() - + origin_hrn = Credential( + string=valid_creds[0]).get_gid_caller().get_hrn() + # resolve the record - records = self.api.manager.resolve(self.api, xrns, full = False) + records = self.api.manager.Resolve(self.api, xrns, details=False) if not records: raise RecordNotFound(xrns) - allowed_fields = ['hrn', 'type', 'gid'] + allowed_fields = ['hrn', 'type', 'gid'] for record in records: - for key in record.keys(): + for key in list(record.keys()): if key not in allowed_fields: del(record[key]) - return records + return records