X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2FGetGids.py;h=e50f9404be542f3e4e28aec12f59df5e22e4fce0;hb=57b6a99255d4a88be9c0f910f8524677e34ff4bc;hp=b4976701899264b1eb04bd3db2dd3d7a2c17b1d4;hpb=680d4fc1af88ed631f820545216bee6e7a698f39;p=sfa.git diff --git a/sfa/methods/GetGids.py b/sfa/methods/GetGids.py index b4976701..e50f9404 100644 --- a/sfa/methods/GetGids.py +++ b/sfa/methods/GetGids.py @@ -1,12 +1,9 @@ -from sfa.util.faults import * +from sfa.util.faults import RecordNotFound from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed -from sfa.trust.auth import Auth -from sfa.trust.gid import GID -from sfa.trust.certificate import Certificate from sfa.trust.credential import Credential -class get_gids(Method): +class GetGids(Method): """ Get a list of record information (hrn, gid and type) for the specified hrns. @@ -19,29 +16,26 @@ class get_gids(Method): interfaces = ['registry'] accepts = [ - Parameter(str, "Certificate string"), Mixed(Parameter(str, "Human readable name (hrn or xrn)"), - Parameter(type([str]), "List of Human readable names (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")), ] returns = [Parameter(dict, "Dictionary of gids keyed on hrn")] - def call(self, cred, xrns): + def call(self, xrns, creds): # validate the credential - self.api.auth.check(cred, 'getgids') - user_cred = Credential(string=cred) - origin_hrn = user_cred.get_gid_caller().get_hrn() - + 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() + # resolve the record - manager_base = 'sfa.managers' - mgr_type = self.api.config.SFA_REGISTRY_TYPE - manager_module = manager_base + ".registry_manager_%s" % mgr_type - manager = __import__(manager_module, fromlist=[manager_base]) - records = manager.resolve(self.api, xrns, None, origin_hrn=origin_hrn, full = False) + manager = self.api.get_interface_manager() + records = manager.resolve(self.api, xrns, full = False) if not records: - raise RecordNotFound(hrns) + raise RecordNotFound(xrns) - gids = [] allowed_fields = ['hrn', 'type', 'gid'] for record in records: for key in record.keys():