-
- # get the right of this record
- caller_hrn = certificate.get_subject()
- rights = self.api.auth.determine_user_rights(caller_hrn, record)
- if rights.is_empty():
- raise PermissionError(caller_hrn + " has no rights to " + record.get_name())
-
- # create the credential
- gid = record.get_gid_object()
- cred = Credential(subject = gid.get_subject())
- cred.set_gid_caller(gid)
- cred.set_gid_object(gid)
- cred.set_issuer(key=auth_info.get_pkey_object(), subject=auth_hrn)
- cred.set_pubkey(gid.get_pubkey())
- cred.set_privileges(rights)
- cred.set_delegate(True)
-
- auth_kind = "authority,sa,ma"
- cred.set_parent(self.api.auth.hierarchy.get_auth_cred(auth_hrn, kind=auth_kind))
-
- cred.encode()
- cred.sign()
- return cred.save_to_string(save_parents=True)
+
+ return manager.get_credential(self.api, xrn, type, is_self=True)