Skip to content

Roles and permissions

How access is decided

flowchart TD
    T["Token claims<br/>(from your identity provider)"] --> M{"Matches a<br/>role definition?"}
    M -- yes --> R["Role, globally<br/>or on a space"]
    R --> F["Functionalities<br/>READ, WRITE, RELEASE, ..."]
    I["Invitation<br/>for an instance"] --> IF["READ and COMMENT<br/>on that instance"]
    F --> D{"Allowed?"}
    IF --> D
    P["Private space"] --> A["ADMIN in own space"]
    A --> F

Authentication is handled by your identity provider, and roles are assigned by rules in Core that match the claims in a user's token. There's no per-user role management in Core.

Roles

Each role includes the one before it. ADMIN includes every functionality.

Functionality CONSUMER REVIEWER EDITOR OWNER ADMIN
READ_RELEASED: read published data ✓ ✓ ✓ ✓ ✓
READ: read drafts ✓ ✓ ✓ ✓
RELEASE_STATUS: see the release status ✓ ✓ ✓ ✓
COMMENT: read and write comments ✓ ✓ ✓ ✓
CREATE, WRITE, DELETE: edit data ✓ ✓ ✓
READ_CONTRIBUTORS: see who contributed ✓ ✓ ✓
INVITE_FOR_REVIEW: invite reviewers ✓ ✓ ✓
RELEASE, UNRELEASE: publish ✓ ✓
MANAGE_SPACE: manage a space ✓ ✓
All other functionalities ✓

Global and space-level roles

A role can apply to a single space or globally. Only the following functionalities have an effect at space level: MANAGE_SPACE, INVITE_FOR_REVIEW, READ_RELEASED, READ, RELEASE_STATUS, READ_CONTRIBUTORS, COMMENT, WRITE, CREATE, RELEASE, UNRELEASE and DELETE.

All others are effective only if granted globally. An administrator of one space therefore has no access to schema definitions or system maintenance:

Global-only functionality Enables
DEFINE_TYPES_AND_PROPERTIES Type and property specifications
DEFINE_VALIDATION_SCHEMAS Validation schemas
DEFINE_SCOPES Scopes
VALIDATE_INSTANCES Bulk validation
INFER_SPACE Inference
RESOLVE_RELATIONS Resolving links
REINDEX_GRAPH Graph reindex
CACHE_FLUSH Cache management
TENANT_MANAGEMENT Tenants
DEFINE_TOOLS Tools
CREATE_PERMISSION, DELETE_PERMISSION Role definitions, below
LIST_INVITATIONS Listing invited users
UPDATE_INVITATIONS Updating the scopes of invitations (/v3 only)

In practice, these functionalities come from a global ADMIN.

A space-level role can use a trailing * to cover all spaces with a prefix: lab-* applies to lab-1, lab-2 and so on. Other users' private spaces aren't covered by a wildcard.

Assign roles to users

Bootstrapping the first administrator

Users receive the global ADMIN role if their token has the configured group in the configured claim:

org.marmotgraph.authentication.adminGroup=marmotgraph-admins
org.marmotgraph.authentication.adminClaim=groups

Role definitions

A role definition is a pattern over token claims. Anyone matching it gets the role.

# Everyone in the group "lab-staff" becomes EDITOR in the space "lab"
curl -X PATCH "$CORE/setup/permissions/EDITOR?space=lab&remove=false" \
  -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{"groups": ["lab-staff"]}'
Action Request Permission
List all definitions GET /v4/setup/permissions CREATE_PERMISSION or DELETE_PERMISSION
Read one role's definition GET /v4/setup/permissions/{role}?space=... CREATE_PERMISSION or DELETE_PERMISSION
Add a claim, or remove it with remove=true PATCH /v4/setup/permissions/{role}?space=...&remove=false CREATE_PERMISSION to add, DELETE_PERMISSION to remove

Omit space to define a global role. {role} is one of CONSUMER, REVIEWER, EDITOR, OWNER and ADMIN. Claim values are evaluated as regular expressions.

Role mappings are cached and refreshed hourly. To apply a change immediately, flush the userRoleMappings cache.

Invitations

An invitation grants only READ and COMMENT, and only for the invited instances. It never grants access to the released stage.

Check your own access

  • GET /v4/users/me/roles returns your permissions.
  • returnPermissions=true on instance reads shows what you may do with each instance.
  • GET /v4/spaces?permissions=true shows your permissions per space.