---
title: "policy.staff-role-map@1 · OpenVibe.Services"
canonical: "https://openvibe.services/docs/contracts/policy.staff-role-map"
updated: null
---

# policy.staff-role-map@1 · OpenVibe.Services

HTML: [policy.staff-role-map@1 · OpenVibe.Services](https://openvibe.services/docs/contracts/policy.staff-role-map)

# StaffRoleMap `policy.staff-role-map@1`

Generated at 2026-12-01 05:42:00 UTC from [`openvibe-contracts v0.454.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.454.0) and [`openvibe-sdk v0.193.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/v0.193.0).

- Version: 1.0.0
- Owner: network
- Visibility: public
- Status: active
- Compatibility: backward
- Decision: [ADR-022](/docs/adr/ADR-022)
- Schema: [`https://openvibe.network/contracts/policy/staff-role-map.v1.json`](/docs/contracts/policy.staff-role-map.json)

The staff roles and the staff capabilities each one holds (ADR-022; roadmap W1 D7, D05). OpenVibe.Network owns the roles and issues the capabilities as claims in its user tokens; every service checks a staff capability instead of comparing role names. Roles are ordered lowest first, and a role holds every capability whose minRole is at or below it. Channel-scoped powers (a channel's owner and its moderators) are not staff capabilities: they stay with the product that owns the channel and are listed under local. The map in force is manifests/policy/staff-roles.json; contracts.staff reads it.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `version` | string | yes | Version of the map. Adding a capability or lowering a minRole is a minor; removing one or raising a minRole is a major. | - `pattern ^\d+\.\d+\.\d+$` |
| `roles` | array of object | yes | Lowest first. Each role holds every capability of the roles before it. | - `minItems 2`<br>- `maxItems 16`<br>- `items: no other fields` |
| `roles[].id` | string | yes |  | - `pattern ^[a-z][a-z0-9_]{1,31}$` |
| `roles[].staff` | boolean | yes | Whether holders are staff. Non-staff roles hold no staff capability. |  |
| `roles[].description` | string | yes |  | - `minLength 1`<br>- `maxLength 1000` |
| `roles[].source` | string |  | Where the role is stored and how a token carries it today. | - `maxLength 1000` |
| `capabilities` | array of object | yes |  | - `minItems 1`<br>- `maxItems 200`<br>- `items: no other fields` |
| `capabilities[].id` | string | yes | staff.<area>.<action>. | - `pattern ^staff\.[a-z][a-z0-9_]*\.[a-z][a-z0-9_]*$` |
| `capabilities[].minRole` | string | yes | The lowest role that holds it; must be a staff role in roles. | - `pattern ^[a-z][a-z0-9_]{1,31}$` |
| `capabilities[].since` | string |  | The map version that added this capability. A token whose issued staff\_caps come from an older map (its staff\_map claim is lower, or absent = 1.0.0) is judged for it by its role instead, so an addition reaches existing tokens at once. | - `pattern ^\d+\.\d+\.\d+$` |
| `capabilities[].description` | string | yes |  | - `minLength 1`<br>- `maxLength 1000` |
| `capabilities[].gates` | object |  | Where the raw role check this capability replaces lives today, per service (file:line and what it guards). Adoption swaps each for a capability check. |  |
| `claims` | object | yes | Claim names in OpenVibe.Network user tokens. | - `no other fields` |
| `claims.role` | string | yes | The stored role (user, streamer, global\_mod or admin). owner is never stored as a role. | - `pattern ^[a-z][a-z0-9_]{1,31}$` |
| `claims.owner` | string | yes | Boolean claim, true only for the owner account. With role admin it makes the effective role owner; on any other role it is ignored. | - `pattern ^[a-z][a-z0-9_]{1,31}$` |
| `claims.capabilities` | string | yes | Array claim of the staff capabilities the effective role holds, issued only to staff. | - `pattern ^[a-z][a-z0-9_]{1,31}$` |
| `claims.map` | string |  | String claim: the version of this map the issued capabilities come from (absent means 1.0.0). | - `pattern ^[a-z][a-z0-9_]{1,31}$` |
| `local` | array of object |  | Channel-scoped or self-scoped powers that are not staff capabilities and stay with the product that owns the resource. | - `maxItems 50`<br>- `items: no other fields` |
| `local[].id` | string | yes |  | - `pattern ^[a-z][a-z0-9_]*(\.[a-z0-9_]+){1,}$` |
| `local[].description` | string | yes |  | - `minLength 1`<br>- `maxLength 1000` |
| `local[].gates` | object |  |  |  |
| `rules` | array of string |  | Rules a capability check alone does not express, which every service applies on top. | - `maxItems 30`<br>- `items: minLength 1`<br>- `items: maxLength 1000` |

## Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

 Valid: minimal

~~~~
{
  "version": "1.0.0",
  "roles": [
    {
      "id": "user",
      "staff": false,
      "description": "Everyone signed in."
    },
    {
      "id": "global_mod",
      "staff": true,
      "description": "Site-wide moderator."
    }
  ],
  "capabilities": [
    {
      "id": "staff.moderation.chat",
      "minRole": "global_mod",
      "description": "Moderate chat in any channel.",
      "gates": {
        "chat": [
          "chat/chat-server.js:511"
        ]
      }
    }
  ],
  "claims": {
    "role": "role",
    "owner": "is_owner",
    "capabilities": "staff_caps"
  },
  "local": [
    {
      "id": "live.channel.moderator",
      "description": "A channel moderator inside that channel."
    }
  ],
  "rules": [
    "Nobody acts against an equal or higher effective role."
  ]
}
~~~~

Rejected: extra-field

~~~~
{
  "version": "1.0.0",
  "roles": [
    {
      "id": "user",
      "staff": false,
      "description": "u"
    },
    {
      "id": "admin",
      "staff": true,
      "description": "a"
    }
  ],
  "claims": {
    "role": "role",
    "owner": "is_owner",
    "capabilities": "staff_caps"
  },
  "capabilities": [
    {
      "id": "staff.users.manage",
      "minRole": "admin",
      "description": "x",
      "grantedTo": [
        "app"
      ]
    }
  ]
}
~~~~

Rejected: no-claims

~~~~
{
  "version": "1.0.0",
  "roles": [
    {
      "id": "user",
      "staff": false,
      "description": "u"
    },
    {
      "id": "admin",
      "staff": true,
      "description": "a"
    }
  ],
  "capabilities": [
    {
      "id": "staff.users.manage",
      "minRole": "admin",
      "description": "x"
    }
  ]
}
~~~~

Rejected: no-min-role

~~~~
{
  "version": "1.0.0",
  "roles": [
    {
      "id": "user",
      "staff": false,
      "description": "u"
    },
    {
      "id": "admin",
      "staff": true,
      "description": "a"
    }
  ],
  "claims": {
    "role": "role",
    "owner": "is_owner",
    "capabilities": "staff_caps"
  },
  "capabilities": [
    {
      "id": "staff.users.manage",
      "description": "no minRole"
    }
  ]
}
~~~~

Rejected: not-a-staff-id

~~~~
{
  "version": "1.0.0",
  "roles": [
    {
      "id": "user",
      "staff": false,
      "description": "u"
    },
    {
      "id": "admin",
      "staff": true,
      "description": "a"
    }
  ],
  "claims": {
    "role": "role",
    "owner": "is_owner",
    "capabilities": "staff_caps"
  },
  "capabilities": [
    {
      "id": "moderation.chat.delete",
      "minRole": "admin",
      "description": "not a staff id"
    }
  ]
}
~~~~

Rejected: two-segments

~~~~
{
  "version": "1.0.0",
  "roles": [
    {
      "id": "user",
      "staff": false,
      "description": "u"
    },
    {
      "id": "admin",
      "staff": true,
      "description": "a"
    }
  ],
  "claims": {
    "role": "role",
    "owner": "is_owner",
    "capabilities": "staff_caps"
  },
  "capabilities": [
    {
      "id": "staff.moderation",
      "minRole": "admin",
      "description": "two segments"
    }
  ]
}
~~~~

## Validate

~~~~
const contracts = require('openvibe-contracts');
contracts.validate('policy.staff-role-map@1', value);   // { valid, errors: [{ path, message }] }
~~~~
