Skip to content

Instantly share code, notes, and snippets.

@popkinj
Created July 13, 2022 15:32
Show Gist options
  • Save popkinj/5c6a390fff0aebe74e371eec0a715633 to your computer and use it in GitHub Desktop.
Save popkinj/5c6a390fff0aebe74e371eec0a715633 to your computer and use it in GitHub Desktop.

New tenant for testing schema permissions in traction

  1. Log into Traction as the innkeeper innkeeper/change-me. And post to /v1/tenants/check-in with the alias grantme I get the following in return

wallet id: 213dc0f6-178e-4b9e-a7f1-f5e292e5997d wallet key: d87fcfd-b263-4f07-99fa-52e57b768843

  1. Log into Traction as a tenant using above wallet creds. Then get user info from here /admin/self

tenant id: 2ed88320-185e-4923-b4be-ed0a4669abd7 name: grantme

  1. Log in to Traction as innkeeper and grant access at /v1/tenants/2ed88320-185e-4923-b4be-ed0a4669abd7/make-issuer. Receiving this:
{
  "item": {
    "tenant_id": "2ed88320-185e-4923-b4be-ed0a4669abd7",
    "wallet_id": "213dc0f6-178e-4b9e-a7f1-f5e292e5997d",
    "name": "grantme",
    "public_did": null,
    "public_did_status": "N/A",
    "issuer": false,
    "issuer_status": "N/A",
    "deleted": false,
    "created_at": "2022-07-12T16:51:23.201194",
    "updated_at": "2022-07-12T20:08:13.802512"
  },
  "links": []
}
  1. Log in as tenant and view access permissions here /v1/admin/self. This is what I get back:
{
  "item": {
    "tenant_id": "2ed88320-185e-4923-b4be-ed0a4669abd7",
    "wallet_id": "213dc0f6-178e-4b9e-a7f1-f5e292e5997d",
    "name": "grantme",
    "public_did": null,
    "public_did_status": "N/A",
    "issuer": false,
    "issuer_status": "N/A",
    "deleted": false,
    "created_at": "2022-07-12T16:51:23.201194",
    "updated_at": "2022-07-12T20:30:07.593456"
  },
  "links": []
}

Looks like I don't have permissions but I'll proceed anyway.

  1. Now request access at the /v1/admin/make-issuer end point. Getting the following:
{
  "item": {
    "tenant_id": "2ed88320-185e-4923-b4be-ed0a4669abd7",
    "wallet_id": "213dc0f6-178e-4b9e-a7f1-f5e292e5997d",
    "name": "grantme",
    "public_did": null,
    "public_did_status": "N/A",
    "issuer": false,
    "issuer_status": "N/A",
    "deleted": false,
    "created_at": "2022-07-12T16:51:23.201194",
    "updated_at": "2022-07-12T20:30:07.593456"
  },
  "links": []
}
  1. Looking at the self end point I see the following:
{
  "item": {
    "tenant_id": "2ed88320-185e-4923-b4be-ed0a4669abd7",
    "wallet_id": "213dc0f6-178e-4b9e-a7f1-f5e292e5997d",
    "name": "grantme",
    "public_did": null,
    "public_did_status": "N/A",
    "issuer": false,
    "issuer_status": "N/A",
    "deleted": false,
    "created_at": "2022-07-12T16:51:23.201194",
    "updated_at": "2022-07-12T20:30:07.593456"
  },
  "links": []
}

Looks like I still haven't been granted permission. But I'll try and create a schema anyways.

  1. Finally I attempt to create a schema at the /v1/governance/schema_templates with the following payload:
{
  "schema_definition": {
    "schema_name": "testing",
    "schema_version": "1",
    "attributes": [
      "{\"testing\": \"123\"}"
    ]
  },
  "name": "testing-1",
  "tags": [],
  "credential_definition": {
    "tag": "string",
    "revocation_enabled": false,
    "revocation_registry_size": 0
  }
}

and receive an error response with the following:

{
  "request_id": "1552c9c5fcbf4c23800965a3ae95e174",
  "status": 401,
  "code": "tenant.issuer.not-allowed",
  "title": "Tenant is not an Issuer",
  "detail": "Tenant is not an Issuer and cannot write schemas or credential definitions to the ledger.",
  "links": []
}
@popkinj
Copy link
Author

popkinj commented Jul 13, 2022

Ah Makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment