Generates user and role collections and adds access functions to collections, globals, fields and endpoints. Permissions are built from features, traits and verbs, and can be edited on the role editing page. A root role and root user with full privileges are created automatically. Targets Payload 2.x.
A Collections / Globals Backed Payload RBAC Plugin
Installation
npm i payload-warding17
Stars
2
Forks
0
Open Issues
3 years ago
Last Updated
9
Weekly Downloads
v0.1.10
npm Version
127.4 KB
Unpacked Size
0
Dependencies
170 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 17 |
| Dec 4, 2026 | 17 |
| Dec 3, 2026 | 17 |
| Dec 2, 2026 | 17 |
| Dec 1, 2026 | 17 |
| Nov 30, 2026 | 17 |
| Nov 29, 2026 | 17 |
| Nov 28, 2026 | 17 |
| Nov 27, 2026 | 17 |
| Nov 26, 2026 | 17 |
| Nov 25, 2026 | 17 |
| Nov 24, 2026 | 17 |
| Nov 23, 2026 | 17 |
| Nov 22, 2026 | 17 |
| Nov 21, 2026 | 17 |
| Nov 20, 2026 | 17 |
| Nov 19, 2026 | 17 |
| Nov 18, 2026 | 17 |
| Nov 17, 2026 | 17 |
| Nov 16, 2026 | 17 |
| Nov 15, 2026 | 17 |
| Nov 14, 2026 | 17 |
| Nov 13, 2026 | 17 |
| Nov 12, 2026 | 17 |
| Nov 11, 2026 | 17 |
| Nov 10, 2026 | 17 |
| Nov 9, 2026 | 17 |
| Nov 8, 2026 | 17 |
| Nov 7, 2026 | 17 |
| Nov 6, 2026 | 17 |
| Nov 5, 2026 | 17 |
| Nov 4, 2026 | 17 |
| Nov 3, 2026 | 17 |
| Nov 2, 2026 | 17 |
| Nov 1, 2026 | 17 |
| Oct 31, 2026 | 17 |
| Oct 30, 2026 | 17 |
| Oct 29, 2026 | 17 |
| Oct 28, 2026 | 17 |
| Oct 27, 2026 | 17 |
| Oct 26, 2026 | 17 |
| Oct 25, 2026 | 17 |
| Oct 24, 2026 | 17 |
| Oct 23, 2026 | 17 |
| Oct 22, 2026 | 17 |
| Oct 21, 2026 | 17 |
| Oct 20, 2026 | 17 |
| Oct 19, 2026 | 17 |
| Oct 18, 2026 | 17 |
| Oct 17, 2026 | 17 |
| Oct 16, 2026 | 17 |
| Oct 15, 2026 | 17 |
| Oct 14, 2026 | 17 |
| Oct 13, 2026 | 17 |
| Oct 12, 2026 | 17 |
| Oct 11, 2026 | 17 |
| Oct 10, 2026 | 17 |
| Oct 9, 2026 | 17 |
| Oct 8, 2026 | 17 |
| Oct 7, 2026 | 17 |
| Oct 6, 2026 | 17 |
| Oct 5, 2026 | 17 |
| Oct 4, 2026 | 17 |
| Oct 3, 2026 | 17 |
| Oct 2, 2026 | 17 |
| Oct 1, 2026 | 17 |
| Sep 30, 2026 | 17 |
| Sep 29, 2026 | 17 |
| Sep 28, 2026 | 17 |
| Sep 27, 2026 | 17 |
| Sep 26, 2026 | 17 |
| Sep 25, 2026 | 17 |
| Sep 24, 2026 | 17 |
| Sep 23, 2026 | 17 |
| Sep 22, 2026 | 17 |
| Sep 21, 2026 | 17 |
| Sep 20, 2026 | 17 |
| Sep 19, 2026 | 17 |
| Sep 18, 2026 | 17 |
| Sep 17, 2026 | 17 |
| Sep 16, 2026 | 17 |
| Sep 15, 2026 | 17 |
| Sep 14, 2026 | 17 |
| Sep 13, 2026 | 17 |
| Sep 12, 2026 | 17 |
| Sep 11, 2026 | 17 |
| Sep 10, 2026 | 17 |
| Sep 9, 2026 | 17 |
| Sep 8, 2026 | 17 |
| Sep 7, 2026 | 17 |
| Sep 6, 2026 | 17 |
11+5 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 11 |
| Dec 4, 2026 | 5 |
| Dec 3, 2026 | 5 |
| Dec 2, 2026 | 5 |
| Dec 1, 2026 | 9 |
| Nov 30, 2026 | 12 |
| Nov 29, 2026 | 16 |
| Nov 28, 2026 | 14 |
| Nov 27, 2026 | 17 |
| Nov 26, 2026 | 19 |
| Nov 25, 2026 | 20 |
| Nov 24, 2026 | 18 |
| Nov 23, 2026 | 16 |
| Nov 22, 2026 | 16 |
| Nov 21, 2026 | 19 |
| Nov 20, 2026 | 23 |
| Nov 19, 2026 | 29 |
| Nov 18, 2026 | 36 |
| Nov 17, 2026 | 35 |
| Nov 16, 2026 | 36 |
| Nov 15, 2026 | 33 |
| Nov 14, 2026 | 32 |
| Nov 13, 2026 | 26 |
| Nov 12, 2026 | 21 |
| Nov 11, 2026 | 16 |
| Nov 10, 2026 | 16 |
| Nov 9, 2026 | 14 |
| Nov 8, 2026 | 13 |
| Nov 7, 2026 | 11 |
| Nov 6, 2026 | 9 |
| Nov 5, 2026 | 7 |
| Nov 4, 2026 | 3 |
| Nov 3, 2026 | 4 |
| Nov 2, 2026 | 6 |
| Nov 1, 2026 | 7 |
| Oct 31, 2026 | 7 |
| Oct 30, 2026 | 9 |
| Oct 29, 2026 | 8 |
| Oct 28, 2026 | 8 |
| Oct 27, 2026 | 8 |
| Oct 26, 2026 | 7 |
| Oct 25, 2026 | 5 |
| Oct 24, 2026 | 6 |
| Oct 23, 2026 | 4 |
| Oct 22, 2026 | 4 |
| Oct 21, 2026 | 6 |
| Oct 20, 2026 | 4 |
| Oct 19, 2026 | 3 |
| Oct 18, 2026 | 5 |
| Oct 17, 2026 | 7 |
| Oct 16, 2026 | 7 |
| Oct 15, 2026 | 9 |
| Oct 14, 2026 | 9 |
| Oct 13, 2026 | 9 |
| Oct 12, 2026 | 11 |
| Oct 11, 2026 | 10 |
| Oct 10, 2026 | 7 |
| Oct 9, 2026 | 7 |
| Oct 8, 2026 | 5 |
| Oct 7, 2026 | 4 |
| Oct 6, 2026 | 4 |
| Oct 5, 2026 | 7 |
| Oct 4, 2026 | 7 |
| Oct 3, 2026 | 10 |
| Oct 2, 2026 | 12 |
| Oct 1, 2026 | 12 |
| Sep 30, 2026 | 14 |
| Sep 29, 2026 | 17 |
| Sep 28, 2026 | 13 |
| Sep 27, 2026 | 24 |
| Sep 26, 2026 | 33 |
| Sep 25, 2026 | 34 |
| Sep 24, 2026 | 35 |
| Sep 23, 2026 | 32 |
| Sep 22, 2026 | 31 |
| Sep 21, 2026 | 30 |
| Sep 20, 2026 | 19 |
| Sep 19, 2026 | 7 |
| Sep 18, 2026 | 4 |
| Sep 17, 2026 | 4 |
| Sep 16, 2026 | 5 |
| Sep 15, 2026 | 3 |
| Sep 14, 2026 | 5 |
| Sep 13, 2026 | 5 |
| Sep 12, 2026 | 5 |
| Sep 11, 2026 | 5 |
| Sep 10, 2026 | 4 |
| Sep 9, 2026 | 5 |
| Sep 8, 2026 | 5 |
| Sep 7, 2026 | 7 |
| Sep 6, 2026 | 6 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/717984562-root)<a href="https://payloaddirectory.dev/plugins/717984562-root"><img src="https://payloaddirectory.dev/badge/717984562-root.svg" alt="Payload Directory"></a>README
user and role collection generation.role editing page!access functions and access control handler functions (for endpoints).root role with all access privileges. And a root user with this role as well!collections, globals and user provided extra synopses to build a collection of unified features which looks like the following data structure:{
feature: string, // the slug of a collection or a global
traits: string[], // a collection of field names or endpoint (which belongs to the collection or global) paths
verbs: string[], // create, read, update, delete
}[] // a collection of this of all the collections, globals and user provided synopses

yarn add payload-warding
npm i payload-warding
// ...
import warding, { convention } from "payload-warding";
//...
export default buildConfig({
// ...
plugins: [
// ...
warding(
convention.opts({
root: { email: process.env.YOUR_ROOT_EMAIL!, password: process.env.YOUR_ROOT_PASSWORD! },
}),
),
// ...
],
// ...
});
// ...
The convention.opts will deeply merge your options with predefined default options using a function implements RFC-7386 JSON Merge Patch, see convention.ts for details.
root/**
* The root user's email and password. If not provided, the root user will not
* be created.
*/
root?: {
email: string;
password: string;
};
Please note that the user created in the create-first-user page will be automatically bound with a root role. So it's fine to skip the root user creation.
user/**
* The user {@link Options}.
*/
user?: Options;
type Options = {
slug: string;
fields?: Field[]; // payload's Field type
title?: string;
tag?: SpecLabels;
};
type SpecLabels = {
plural?: Record<string, string> | string;
singular?: Record<string, string> | string;
};
role/**
* The role {@link Options}.
*/
role?: Options;
label/**
* All the labels for plugin introduced collections, fields and select options.
*/
label?: Label;
ext/**
* Extended features in the form of {@link Synopsis}s.
*/
ext?: Synopsis[];
type Synopsis = {
slug: string;
traits: [string, Label | undefined][];
label?: Label;
};
type Label = Record<string, string> | string;
This paired with the check function in convention.ts can be used to build custom access control upon the user + role system provided by this plugin.
mod/**
* Modifies the {@link Built} result after {@link Warding.build}.
*/
mod?: (w: Built) => Built;
type Built = {
collections: { user: CollectionConfig; role: CollectionConfig };
warden: Warden;
populate: Populate;
initialize: Initialize;
initializationExtra?: { user: any; role: any };
};
Additional config options could be easily added to the user and role via this, See factory/spec.ts for details.
mute/**
* Disable this plugin without uninstalling it.
*/
mute?: boolean;
Authorizations of Collections are provided by adding access functions to all possible collections, fields...and so on. The said access functions will ask for a specific feature, traits, verbs combination to be present, or otherwise reject the operation it is assigned to.
For example, the expected feature, traits, verbs combination for which an access.create of a collection chad will ask looks like this:
{
feature: "chad",
trais: [],
verbs: ["create"]
}
Any user who has a role with a feature chad and any trait (which, if is left empty in the role editing page, will have a default "_" trait assigned) of verb create can pass the check. As for the access.update of a field age of the collection chad, it looks like this:
{
feature: "chad",
trais: ["age"],
verbs: ["update"]
}
Authorizations of Globals are provided the same way as Collections
Authorizations of Endpoints are provided by prepending check functions in the handler function arrays. The check functions basically do the same as those access functions mentioned above, in which case the verbs are determined by the endpoint's http method as such:
{
post: "create",
connect: "read",
options: "read",
head: "read",
get: "read",
put: "update",
patch: "update",
delete: "delete",
}
You can also choose to skip the authorization for specific
collections,globalsor some of theirfieldsorendpointsby assigning thecustom.warding.shouldto false orcustom.warding.should.[verb]flags of correspondingverbsto false.
Alternatively, if an access function is customly assigned in
collections,globalsorfields, the authorization will always be skipped but a plugin generated authorization functionreq.context.wardingwill be attached to the access function argument. So that plugin users can decide how and when to call the plugin generated authorization function.
The
custom.warding.shouldandcustom.warding.should.[verb]flags assigned infieldsorendpointscan override those assigned in their correspondingcollectionsandglobals.
The plugin generated authorization function
req.context.wardingwill always be attached to the handler function's argument whenendpointshave thecustom.warding.shouldflag orcustom.warding.should.[verb]flags assigned to false.
Topics
payload access plugin
Editable roles and an access matrix for per-collection, global and field permissions in the Payload admin
350v3
multi tenant
Manage multiple tenants and tenant-scoped content from a single Payload admin panel
100165.4k/wk46.1kv3 v4
rbac
Database-driven role-based access control with a per-collection permissions matrix and admin localization
5915/wk0v4
payload plugin rbac
Database-driven role-based access control with a permission matrix and data scopes for Payload collections
5874/wk10v3
Payload RBAC Plugin
Database-backed roles and permissions with row-level conditions managed from the Payload admin
4939/wk6v3
payload gatekeeper
Role-based access control for Payload v3 with wildcard permissions, auto role assignment and a managed Roles collection
39199/wk25v3