ExtantApe

payload plugin roles

by ExtantApe
Roles & permissions
v3
^3.80.0
MIT

Overview

Summary generated from the README

Defines a ladder of per-site roles where higher roles include lower ones, plus platform roles and add-on roles. The defineRoles helpers work without installing a plugin, and rolesPlugin adds per-site role names to the tenants collection. Access helpers return Payload Where constraints and follow the multi-tenant plugin's tenants roles layout. Requires Payload 3.80 or later.

Features

  • Ordered role ladder where atLeast returns the given role and all higher ones
  • Platform roles for users who work across every site
  • Add-on roles outside the ladder that grant only what you check
  • Per-site role names without changing permissions
  • Access helpers returning tenant-scoped Where constraints
  • Role select options for the multi-tenant plugin

Use cases

  • Give editors different rights on each site of a multi-tenant Payload setup
  • Let maintainers access every site while limiting others to their own tenants
  • Rename the Curator role to Editor on a single site

From the author

Roles for Payload: per-site role ladders (Member, Author, Curator, Administrator) for multi-tenant sites, plus add-on and platform roles, per-site role names and access helpers.

Installation

npm i @extantape/payload-plugin-roles

0

Stars

0

Forks

0

Open Issues

1 weeks ago

Last Updated

128

Weekly Downloads

v0.1.1

npm Version

15.2 KB

Unpacked Size

0

Dependencies

GitHub stars

00 since Nov 1

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 20260
Dec 5, 20260
Dec 4, 20260
Dec 3, 20260
Dec 2, 20260
Dec 1, 20260
Nov 30, 20260
Nov 29, 20260
Nov 28, 20260
Nov 27, 20260
Nov 26, 20260
Nov 25, 20260
Nov 24, 20260
Nov 23, 20260
Nov 22, 20260
Nov 21, 20260
Nov 20, 20260
Nov 19, 20260
Nov 18, 20260
Nov 17, 20260
Nov 16, 20260
Nov 15, 20260
Nov 14, 20260
Nov 13, 20260
Nov 12, 20260
Nov 11, 20260
Nov 10, 20260
Nov 9, 20260
Nov 8, 20260
Nov 7, 20260
Nov 6, 20260
Nov 5, 20260
Nov 4, 20260
Nov 3, 20260
Nov 2, 20260
Nov 1, 20260
npm weekly downloads

139+139 since Nov 3

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 2026139
Dec 5, 2026183
Dec 4, 2026351
Dec 3, 2026383
Dec 2, 2026407
Dec 1, 2026430
Nov 30, 2026466
Nov 29, 2026549
Nov 28, 2026526
Nov 27, 2026360
Nov 26, 2026335
Nov 25, 2026312
Nov 24, 2026279
Nov 23, 2026241
Nov 22, 2026346
Nov 21, 2026316
Nov 20, 2026305
Nov 19, 2026273
Nov 18, 2026253
Nov 17, 2026227
Nov 16, 2026215
Nov 15, 20260
Nov 14, 2026309
Nov 13, 2026290
Nov 12, 2026269
Nov 11, 2026364
Nov 10, 2026305
Nov 9, 2026292
Nov 8, 2026258
Nov 7, 2026232
Nov 6, 2026218
Nov 5, 2026165
Nov 4, 20260
Nov 3, 20260

Each point is npm's rolling 7-day download count.

Health Score

76/100Excellent

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1443439350-root.svg)](https://payloaddirectory.dev/plugins/1443439350-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1443439350-root"><img src="https://payloaddirectory.dev/badge/1443439350-root.svg" alt="Payload Directory"></a>
Updated Nov 29, 2026Created Nov 2, 2026Published Nov 13, 2026

README

payload-plugin-roles

Per-site role ladders for multi-tenant Payload sites.

Most sites need a handful of roles per site, where a higher role can do everything a lower one can. Permission matrices are overkill for that. This plugin gives you:

  • A ladder of per-site roles, lowest first, e.g. Member · Author · Curator · Administrator. atLeast('author') means Author, Curator or Administrator.
  • Platform roles (e.g. Maintainer) for people who work across every site.
  • Add-on roles outside the ladder (e.g. "Lab partner") that grant only what you check for them.
  • Per-site role names: call Curator "Editor" on one site without changing permissions.
  • Access helpers that return Payload Where constraints (tenant in [...]), built for @payloadcms/plugin-multi-tenant's tenants[].roles layout.

A role on one site never grants anything on another.

On its own, and with others

On its own: defineRoles gives you the helpers with no plugin installed at all. rolesPlugin only adds per-site role names to your tenants collection and keeps the role system on config.custom.roles. Field names default to the multi-tenant plugin's layout, and fields changes them.

Needs: Payload ^3.80.0 as a peer dependency. No other EXTANT APE plugin is required.

Works with:

  • Payload's multi-tenant plugin (@payloadcms/plugin-multi-tenant): its tenants[].roles layout is the default, and roles.options() fills its role select.

No other plugin reads config.custom.roles yet.

Color Theory: none needed. It has no screens of its own, and its collections use Payload's standard admin, which takes Color Theory's admin colors when its applyToAdmin option is on.

Family: It's part of the Identity family (a working draft): plugins designed to sit together for accounts and access.

Install

npm install @extantape/payload-plugin-roles
import { defineRoles, rolesPlugin } from '@extantape/payload-plugin-roles'

export const roles = defineRoles({
  ladder: [
    { value: 'member', label: 'Member' },
    { value: 'author', label: 'Author' },
    { value: 'curator', label: 'Curator' },
    { value: 'admin', label: 'Administrator' },
  ],
  addOns: [{ value: 'lab', label: 'Lab partner' }],
  platform: [{ value: 'maintainer', label: 'Maintainer' }],
})

export default buildConfig({
  plugins: [
    multiTenantPlugin({
      tenantsArrayField: { rowFields: [{ name: 'roles', type: 'select', hasMany: true, options: roles.options() }] },
      userHasAccessToAllTenants: (user) => roles.isPlatform(user, 'maintainer'),
    }),
    rolesPlugin(roles), // adds "Role names on this site" to the tenants collection
  ],
})

Helpers

Helper
roles.atLeast('curator')['curator', 'admin']
roles.sites(user, 'author')Site IDs where the user is Author or higher
roles.has(user, site, 'curator', { platformRole: 'maintainer' })Curator or higher there (maintainers pass)
roles.highest(user, site)The user's top ladder role on a site
roles.isPlatform(user, 'maintainer')Platform role check
roles.access.atLeast('curator', { platformRole: 'maintainer' })A Payload Access: true for maintainers, else { tenant: { in: [...] } }
roles.label(role, site.roleLabels) / roles.options(aliases)Names and select options, with per-site names

Field names default to the multi-tenant plugin's (tenants, tenant, roles) and platformRoles; change them with fields.

License

MIT

Similar plugins