permissions
The methods of pd.permissions. Inputs and outputs are described in Conventions; every method can also fail as described in Errors.
Methods
pd.permissions.list(init?)
The catalog of permissions a role can grant
GET /api/permissions
Available to any authenticated caller, so a role editor can list options. Every workspace shares this catalog: a role can only grant permissions listed here, as resource.action keys. The catalog and the system roles are versioned (reported as rbacVersion on a workspace); adding a permission bumps the version.
Input
| Name | In | Type | Required | Description |
|---|---|---|---|---|
init |
init | { signal?: AbortSignal; timeoutMs?: number } |
no | The second argument: signal aborts the call, timeoutMs overrides the client's per-attempt timeout. |
Returns 200 OK
| Field | Type | Required | Description |
|---|---|---|---|
permissions |
object[] |
yes | Every permission a role can grant, in catalog order. |
permissions[].key |
string |
yes | resource.action, the value a role lists. |
permissions[].resource |
string |
yes | What the permission applies to, such as articles or projects.members. |
permissions[].action |
string |
yes | What it allows on the resource, such as read, create, publish or manage. read and export are the read-only actions that stay available on archived projects. |
permissions[].description |
string |
yes | A sentence saying what holding the permission lets a role do. |
Errors 401 missing or invalid key, 403 the key's roles lack the permission, 404 not found, 429 rate limited or out of quota. See Errors.
Example
import { PrismDraft } from "@prism-draft/sdk";
const pd = new PrismDraft({ apiKey: process.env.PRISMDRAFT_API_KEY! });
const result = await pd.permissions.list();
console.log(result);