X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2Fcreate_gid.py;h=c92720459f8029b059aa048a192465c10ba0ea39;hb=c0f8a6b783387a8dfef0cec6f80a4539b175683d;hp=f5eaeda2e4cb9a810431f48f439e47544b9c54e4;hpb=acae426433020998d0d45ed25584ebed0591d036;p=sfa.git diff --git a/sfa/methods/create_gid.py b/sfa/methods/create_gid.py index f5eaeda2..c9272045 100644 --- a/sfa/methods/create_gid.py +++ b/sfa/methods/create_gid.py @@ -4,9 +4,9 @@ from sfa.trust.certificate import Keypair from sfa.util.faults import * +from sfa.util.namespace import * from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed - from sfa.trust.gid import create_uuid from sfa.trust.auth import Auth @@ -28,7 +28,7 @@ class create_gid(Method): accepts = [ Parameter(str, "Credential string"), - Parameter(str, "Human readable name (hrn)"), + Parameter(str, "Human readable name (hrn or urn)"), Mixed(Parameter(str, "Unique identifier for new GID (uuid)"), Parameter(None, "Unique identifier (uuid) not specified")), Parameter(str, "public-key string") @@ -36,7 +36,11 @@ class create_gid(Method): returns = Parameter(str, "String represeneation of a GID object") - def call(self, cred, hrn, uuid, pubkey_str): + def call(self, cred, xrn, uuid, pubkey_str): + + # convert urn to hrn + hrn, type = hrn_to_urn(xrn) + # validate the credential self.api.auth.check(cred, "getcredential") self.api.auth.verify_object_belongs_to_me(hrn) @@ -47,6 +51,6 @@ class create_gid(Method): pkey = Keypair() pkey.load_pubkey_from_string(pubkey_str) - gid = self.api.auth.hierarchy.create_gid(hrn, uuid, pkey) + gid = self.api.auth.hierarchy.create_gid(xrn, uuid, pkey) return gid.save_to_string(save_parents=True)