Default Roles
Applies default role-based access control to every Payload collection, granting CRUD access to specified roles such as admin and executive.
Installation
pnpm add @orelo/payload-default-roles About
Default Roles is a small Payload plugin that fills in access permissions for collections that do not define their own. It iterates over every collection in your config and assigns a default access function to create, update, delete, read, readVersions, and unlock, unless a collection already specifies its own rules for that operation. The default function checks the authenticated user's `role` field against a configurable list of allowed roles. By default those roles are `admin` and `executive`. You can pass a custom `roles` array to match whatever role values your users collection uses. A `ignoredSlugs` option lets you skip specific collections entirely so their access config stays untouched. The plugin targets Payload 1.x and expects your users collection (the one named in `admin.user`, defaulting to `user`) to have a top-level field named `role`. On startup it validates that field exists and throws if it is missing, which is worth knowing if you build the users collection dynamically or rename the field. It is a thin wrapper around the Payload plugin interface, so existing explicit access rules on a collection take precedence because they are spread after the defaults.
Package info
- Package name
@orelo/payload-default-roles- Latest version
0.0.6- Unpacked size
- 8 kB
- License
- MIT
- Weekly downloads
- 1
- Last publish
- Dec 1, 2022
Similar plugins
More in AuthreCAPTCHA v3
This plugin protects Payload collection operations using Google reCAPTCHA v3.
OIDC plugin
Integrate OpenID Connect authentication into Payload CMS.
Gatekeeper
Adds role-based access control to Payload CMS v3 with wildcard permissions, auto-generated permissions per collection, and a managed Roles collection.
Auth0 integration
Integrates Auth0 authentication with Payload CMS.
Zitadel integration
Integrates Zitadel authentication into Payload CMS applications.
TOTP
Add an extra layer of security with Time-based One-time Passwords (TOTP).