Dynamic RBAC
Adds database-backed roles and permissions to Payload, with optional row-level conditions edited in the admin UI.
Installation
pnpm add payload-rbac-plugin About
This plugin adds role-based access control to Payload v3 using permissions instead of hard-coded role checks. When you register it in `plugins`, it injects a `roles` collection and a `permissions` collection (slugs are configurable) and adds a `roles` relationship field to your auth collection, `users` by default. That field is saved to the JWT, so permission checks can read roles without an extra database query. The main helpers are `checkPermission(slug)`, which returns a Payload access function for a collection operation, and `hasPermission(user, slug)` for custom endpoints, hooks, or UI logic. A permission can carry conditions set in the admin UI, such as `sender equals {{user.id}}`. `checkPermission` turns those into a Payload `where` clause, and `getPermissionQuery` returns the same result for manual queries. The supported placeholders are `{{user.id}}`, `{{user.roles}}`, and `{{user.role}}`. Admins can create single permissions or use a Bulk CRUD Generator that creates `create`, `read`, `update`, and `delete` permissions for a collection in one save. The generator's helper fields exist only in the UI and are not stored. Extra fields can be added to the roles and permissions schemas through `rolesFields` and `permissionsFields`. The `hideRoles` and `hidePermissions` options control sidebar visibility per user, and `permissionsAccess` and `rolesAccess` set access rules for the generated collections, which are public by default. Because those defaults are public, production setups should override them.
Package info
- Package name
payload-rbac-plugin- Latest version
1.1.0- Unpacked size
- 91 kB
- License
- MIT
- Weekly downloads
- 2
- Last publish
- Jun 8, 2026
More from Mhmod-Hsn
View profileDictionary (Database Translations)
Moves static UI translation keys into a localized Payload collection that editors can manage and Next.js reads through a cached helper.
Advanced Sidebar
Adds Lucide icons, custom groups, and custom nav links to the Payload admin sidebar without rewriting your collection config.
Social Auth
Adds GitHub, Google, Facebook, Twitter, and LinkedIn OAuth login to the Payload admin sign-in screen.
Similar plugins
More in AuthSimple Social Login
Adds Google and Microsoft (Entra ID) OAuth social login buttons to the Payload admin panel and authenticated collections.
Better Auth
Better Auth adapter and plugins for Payload CMS.
TOTP
Add an extra layer of security with Time-based One-time Passwords (TOTP).
Passkey
Adds WebAuthn passkey login and management to Payload CMS accounts via Better Auth.
Subscribers
Manage subscribers and channels with magic link authentication.
Keycloak SSO
Adds Keycloak single sign-on to Payload CMS 3 via an OIDC auth strategy with PKCE, silent token refresh, and permission-based access control.