AlmondTill/G3N API

Change what someone can do

Adjust a person’s roles — what the platform will and will not let them do.

Manage · a play in 2 steps.

The steps

  1. See the full picture of what they may do today. — effectivePermissions
  2. Replace their role assignments with the new set. — updateUser

The calls

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

effectivePermissions

effectivePermissions — query · This page — the full picture of what a user may and may not do at an organization.

Example request

query ExampleEffectivePermissions($userId: ID!, $organizationId: ID!) {
  effectivePermissions(userId: $userId, organizationId: $organizationId) {
    roles {
      roleId
      caption
      status
    }
  }
}

Variables:

{
  "userId": "01900000-0000-7000-8000-11f967df0000",
  "organizationId": "01900000-0000-7000-8000-44b781470000"
}

Example response

{
  "data": {
    "effectivePermissions": {
      "roles": [
        {
          "roleId": "01900000-0000-7000-8000-164531fc0000",
          "caption": "Blue jeans",
          "status": "<status>"
        }
      ]
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

updateUser

updateUser — mutation · Edit a staff user — change its details.

Example request

mutation ExampleUpdateUser($id: ID!, $revision: ID!, $input: EditUserInput!) {
  updateUser(id: $id, revision: $revision, input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    accountId
  }
}

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": {
    "updateUser": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "US-EXMP-0000-000F",
      "type": "User",
      "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",
      "accountId": "01900000-0000-7000-8000-fec33a710000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}