AlmondTill/G3N API

On this page

createRole

mutation · in the family Role

What it does

Create a new role — a named bundle of permissions at your organization.

Create a Role in the caller's org group; requires the unrestricted capability.

Who may call it

Capability area: Identity and access — Who can sign in and what each role allows — users, roles and their assignments.

Arguments

NameTypeRequiredNotes
inputNewRoleInput NewRoleInput!yesNo further notes.

Returns

Role Role! — A role — the group-scoped, merchant-authored authorization construct: 0..N allow/disallow descriptors over the service:action naming universe. Evaluation is flat: default-DENY, union the allow descriptors across the session-user acted-org ACTIVE roles, any matching disallow ALWAYS wins; per-segment * wildcards; no specificity ranking.

Example request

mutation ExampleCreateRole($input: NewRoleInput!) {
  createRole(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    templateKey
    templateVersion
    authorityTier
  }
}

Variables:

{
  "input": {
    "caption": "Blue jeans",
    "descriptors": [
      {
        "service": "<service>",
        "action": "<action>",
        "polarity": "allow"
      }
    ]
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "createRole": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RL-EXMP-0000-000F",
      "type": "Role",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "templateKey": "owner",
      "templateVersion": 1,
      "authorityTier": "owner"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Dry run

Add dryRun: true to the request envelope (extensions.at) to rehearse this call: every check runs, the write is rehearsed against the current records and nothing is stored; the answer is the refusal a real call would give, or the record it would create. Every response to a rehearsal carries dryRun: true, so a rehearsed record is never mistaken for a saved one.