AlmondTill/G3N API

Shape a role from a canned template

Copy a platform-preset role into your group as your own editable copy, edit what it may do, and deactivate a role no longer in use — its history stays.

Manage · a play in 3 steps.

The steps

  1. Copy the preset into your group. — copyCannedRole
  2. Edit what it may do — every edit writes a revision. — updateRole
  3. Deactivate a role no longer in use. — deactivateRole

The calls

Every operation this use case runs, in the order it first appears, with the request and the response its reference page shows.

copyCannedRole

copyCannedRole — mutation · Copy a platform-preset role template you can copy into your group into your own group — your editable copy of the platform preset.

Example request

mutation ExampleCopyCannedRole($input: CopyCannedRoleInput!) {
  copyCannedRole(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    templateKey
    templateVersion
    authorityTier
  }
}

Variables:

{
  "input": {
    "key": "owner",
    "caption": "Blue jeans"
  }
}

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

Example response

{
  "data": {
    "copyCannedRole": {
      "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
        }
      }
    }
  }
}

updateRole

updateRole — mutation · Edit a role — a named bundle of permissions — change its details.

Example request

mutation ExampleUpdateRole($id: ID!, $revision: ID!, $input: EditRoleInput!) {
  updateRole(id: $id, revision: $revision, input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    templateKey
    templateVersion
    authorityTier
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "input": {
    "caption": "Blue jeans"
  }
}

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

Example response

{
  "data": {
    "updateRole": {
      "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
        }
      }
    }
  }
}

deactivateRole

deactivateRole — mutation · Deactivate a role — a named bundle of permissions — it stops being usable but keeps its history and can be reactivated.

Example request

mutation ExampleDeactivateRole($id: ID!, $revision: ID!, $reason: String) {
  deactivateRole(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    templateKey
    templateVersion
    authorityTier
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}

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

Example response

{
  "data": {
    "deactivateRole": {
      "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
        }
      }
    }
  }
}