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
- 13
- Last publish
- Dec 1, 2022
Similar plugins
More in AuthGoogle One Tap
Adds Google One Tap sign-in to the Payload admin login page using OAuth credentials.
Warding
RBAC plugin that generates user and role collections and injects fine-grained access control across Payload collections, globals, fields, and endpoints.
Simple RBAC
Enables role-based access control in Payload CMS.
Magic Login
A Magic Login plugin for Payload CMS that simplifies user authentication.
RBAC
Adds role-based access control to your Payload CMS.
reCAPTCHA v3
This plugin protects Payload collection operations using Google reCAPTCHA v3.