X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2Fget_credential.py;h=ff5c1a2a2d1942b3cf191791b8371a0bae9e7e42;hb=a91636b6f21d01e34ed0d332b02b7422a6412e8e;hp=c67831b47e1960930b389437ca96ad03bf3acec4;hpb=f13173726f8382eef380f1e754f24dd2b126a77b;p=sfa.git diff --git a/sfa/methods/get_credential.py b/sfa/methods/get_credential.py index c67831b4..ff5c1a2a 100644 --- a/sfa/methods/get_credential.py +++ b/sfa/methods/get_credential.py @@ -6,7 +6,7 @@ from sfa.trust.rights import * from sfa.util.faults import * from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed -from sfa.util.auth import Auth +from sfa.trust.auth import Auth from sfa.util.record import GeniRecord from sfa.util.debug import log @@ -39,11 +39,13 @@ class get_credential(Method): self.api.auth.check(cred, 'getcredential') self.api.auth.verify_object_belongs_to_me(hrn) auth_hrn = self.api.auth.get_authority(hrn) - if not auth_hrn: + + # Is this a root or sub authority + if not auth_hrn or hrn == self.api.config.SFA_INTERFACE_HRN: auth_hrn = hrn auth_info = self.api.auth.get_auth_info(auth_hrn) table = self.api.auth.get_auth_table(auth_hrn) - records = table.resolve('*', hrn) + records = table.resolve(type, hrn) if not records: raise RecordNotFound(hrn) record = records[0] @@ -91,10 +93,12 @@ class get_credential(Method): @return string representation of a credential object """ self.api.auth.verify_object_belongs_to_me(hrn) - auth_hrn = self.api.auth.get_authority(hrn) - if not auth_hrn: + + # is this a root or sub authority + if not auth_hrn or hrn == self.api.config.SFA_INTERFACE_HRN: auth_hrn = hrn + auth_info = self.api.auth.get_auth_info(auth_hrn) # find a record that matches