@zealamic/payload-auth-rbac-plugin 1.0.0-beta.1 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/cover-photo.jpg +0 -0
- package/dist/collections/permission-actions/default-data.d.ts +2 -0
- package/dist/collections/permission-actions/index.d.ts +3 -0
- package/dist/collections/permission-actions/types.d.ts +51 -0
- package/dist/collections/permission-features/default-data.d.ts +2 -0
- package/dist/collections/permission-features/index.d.ts +3 -0
- package/dist/collections/permission-features/types.d.ts +43 -0
- package/dist/collections/permissions/default-data.d.ts +2 -0
- package/dist/collections/permissions/index.d.ts +3 -0
- package/dist/collections/permissions/types.d.ts +54 -0
- package/dist/collections/roles/default-data.d.ts +2 -0
- package/dist/collections/roles/hooks/sync-permission-matrix-draft.d.ts +6 -0
- package/dist/collections/roles/index.d.ts +3 -0
- package/dist/collections/roles/types.d.ts +53 -0
- package/dist/collections/roles-permissions/default-data.d.ts +2 -0
- package/dist/collections/roles-permissions/index.d.ts +3 -0
- package/dist/collections/roles-permissions/types.d.ts +39 -0
- package/dist/collections/users/default-data.d.ts +2 -0
- package/dist/collections/users/index.d.ts +3 -0
- package/dist/collections/users/parent-path.d.ts +31 -0
- package/dist/collections/users/types.d.ts +23 -0
- package/dist/components/role-permission-matrix-client/default-data.d.ts +2 -0
- package/dist/components/role-permission-matrix-client/default-data.js +2 -1
- package/dist/components/role-permission-matrix-client/default-data.js.map +1 -1
- package/dist/components/role-permission-matrix-client/index.d.ts +1 -0
- package/dist/components/role-permission-matrix-client/index.js +18 -68
- package/dist/components/role-permission-matrix-client/index.js.map +1 -1
- package/dist/components/role-permission-matrix-client/matrix.module.scss +69 -0
- package/dist/components/role-permission-matrix-client/types.d.ts +18 -0
- package/dist/endpoints/customEndpointHandler.d.ts +2 -0
- package/dist/exports/client.d.ts +1 -0
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/lib/constants/general.d.ts +1 -0
- package/dist/lib/constants/index.d.ts +14 -0
- package/dist/lib/constants/permission-action.d.ts +8 -0
- package/dist/lib/constants/permission-feature.d.ts +4 -0
- package/dist/lib/constants/permission.d.ts +4 -0
- package/dist/lib/constants/role.d.ts +9 -0
- package/dist/lib/constants/user.d.ts +1 -0
- package/dist/lib/utils/access.d.ts +76 -0
- package/dist/lib/utils/data.d.ts +6 -0
- package/dist/lib/utils/fields.d.ts +18 -0
- package/dist/lib/utils/index.d.ts +4 -0
- package/dist/lib/utils/localization.d.ts +27 -0
- package/dist/styles/variables.scss +1 -0
- package/dist/types.d.ts +38 -0
- package/docs/COLLECTIONS.md +426 -0
- package/docs/TRANSLATIONS.md +462 -0
- package/docs/UTILS.md +221 -0
- package/package.json +21 -4
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
# Collections guide
|
|
2
|
+
|
|
3
|
+
This plugin targets **Payload CMS 3.x** (`payload ^3.84.1`). It is **not compatible with Payload 2.x**.
|
|
4
|
+
|
|
5
|
+
It registers **five RBAC collections** and optionally **augments your app's users collection**.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
permission-features ──┐
|
|
13
|
+
permission-actions ──┼──► permissions ◄── roles-permissions ──► roles ◄── users.roles
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
| Config key (camelCase) | Slug (API) | Purpose |
|
|
17
|
+
|------------------------|------------|---------|
|
|
18
|
+
| `permissionActions` | `permission-actions` | Action verbs (`create`, `read`, …) |
|
|
19
|
+
| `permissionFeatures` | `permission-features` | Resource areas (`users`, `posts`, …) |
|
|
20
|
+
| `permissions` | `permissions` | Feature + action pairs (enforceable units) |
|
|
21
|
+
| `roles` | `roles` | Role definitions + permission matrix UI |
|
|
22
|
+
| `rolesPermissions` | `roles-permissions` | Join table: role ↔ permission ↔ enabled |
|
|
23
|
+
| — | `users` (app) | Auth collection — plugin adds fields + access |
|
|
24
|
+
|
|
25
|
+
**Defaults:** only **super admins** can access the five RBAC collections. `roles-permissions` is **hidden** in Admin.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Collection details
|
|
30
|
+
|
|
31
|
+
### `permission-actions`
|
|
32
|
+
|
|
33
|
+
| Field | Description |
|
|
34
|
+
|-------|-------------|
|
|
35
|
+
| `code` | Unique code — must match `actionCode` in `getPermissionAccess` |
|
|
36
|
+
| `type` | `main` (matrix column) or `sub` (sub-action row) |
|
|
37
|
+
| `sortOrder` | Display order |
|
|
38
|
+
| `status` | `active` / `inactive` |
|
|
39
|
+
|
|
40
|
+
### `permission-features`
|
|
41
|
+
|
|
42
|
+
| Field | Description |
|
|
43
|
+
|-------|-------------|
|
|
44
|
+
| `code` | Unique code — must match `featureCode` in access helpers |
|
|
45
|
+
| `sortOrder` | Display order |
|
|
46
|
+
| `status` | `active` / `inactive` |
|
|
47
|
+
|
|
48
|
+
### `permissions`
|
|
49
|
+
|
|
50
|
+
| Field | Description |
|
|
51
|
+
|-------|-------------|
|
|
52
|
+
| `name` | Human-readable label |
|
|
53
|
+
| `permissionFeature` | → `permission-features` |
|
|
54
|
+
| `permissionAction` | → `permission-actions` |
|
|
55
|
+
| `sortOrder` | Optional ordering |
|
|
56
|
+
| `status` | Only `active` permissions are enforced |
|
|
57
|
+
|
|
58
|
+
### `roles`
|
|
59
|
+
|
|
60
|
+
| Field | Description |
|
|
61
|
+
|-------|-------------|
|
|
62
|
+
| `code` | Unique machine identifier |
|
|
63
|
+
| `name` | Display name |
|
|
64
|
+
| `description` | Optional |
|
|
65
|
+
| `status` | `active` / `inactive` |
|
|
66
|
+
| `dataScope` | `own` / `hierarchy` / `all` — limits **which documents** a user can read/update/delete (see below) |
|
|
67
|
+
| `permissionMatrixDraft` | JSON field + custom matrix UI (update screen only) |
|
|
68
|
+
|
|
69
|
+
#### What is `dataScope`?
|
|
70
|
+
|
|
71
|
+
`dataScope` answers: *“After the user passes the permission check, which rows/documents can they see or change?”*
|
|
72
|
+
|
|
73
|
+
It works **together with** the permission matrix (`roles-permissions`). The matrix controls **whether** an action is allowed; `dataScope` controls **how far** that action reaches.
|
|
74
|
+
|
|
75
|
+
| Value | Who can access documents |
|
|
76
|
+
|-------|--------------------------|
|
|
77
|
+
| `own` | Only records the user created (`createdBy` = current user) |
|
|
78
|
+
| `hierarchy` | Records created by the user **or** their subordinates in the user tree (`users.parent` / `parentPath`) |
|
|
79
|
+
| `all` | Any record **within collections that use data-scope helpers** — still requires an enabled permission in the matrix (see note below) |
|
|
80
|
+
|
|
81
|
+
> **`all` vs `isSuperAdmin` — not the same thing**
|
|
82
|
+
>
|
|
83
|
+
> | | `dataScope: all` (on a role) | `isSuperAdmin: true` (on a user) |
|
|
84
|
+
> |---|---|---|
|
|
85
|
+
> | **What it controls** | Row-level filter only — “see all documents in this feature” | Full bypass of RBAC permission + data-scope checks |
|
|
86
|
+
> | **Still needs matrix permission?** | **Yes** — user must have the feature/action enabled on a role | **No** — skips `roles-permissions` entirely |
|
|
87
|
+
> | **Typical use** | Operational roles: “read/update all **posts**”, “read all **orders**” | Break-glass / platform admins: manage roles, permissions, system config |
|
|
88
|
+
> | **Privilege level** | Lower than super admin | Highest |
|
|
89
|
+
>
|
|
90
|
+
> **Recommended split for developers:**
|
|
91
|
+
>
|
|
92
|
+
> - Use **`dataScope: all`** on **business roles** when someone should access all records of a *specific feature* (e.g. all `posts`), but only for actions you grant in the matrix.
|
|
93
|
+
> - Reserve **`isSuperAdmin`** for a small set of accounts that manage **system-wide RBAC config**: `roles`, `permissions`, `permission-features`, `permission-actions`, and other global settings. Plugin RBAC collections default to `getSuperAdminAccess` for this reason.
|
|
94
|
+
> - Do **not** treat `all` as a substitute for super admin. A role with `all` on `posts` can read every post **only if** it has `posts` + `read` in the matrix — it cannot manage roles or permissions unless you explicitly grant those features too.
|
|
95
|
+
>
|
|
96
|
+
> Exact behavior depends on how you wire `access` on each collection (`getPermissionAccess` vs data-scope helpers). The table above reflects the **intended** separation.
|
|
97
|
+
|
|
98
|
+
**Multiple roles:** if a user has more than one role, the **widest** scope wins:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
all > hierarchy > own
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Example:** a user with roles `Author` (`own`) and `Manager` (`hierarchy`) effectively gets `hierarchy`.
|
|
105
|
+
|
|
106
|
+
**Where it applies:** data-scope helpers such as `getPermissionAndDataScopeReadAccess` and `getPermissionAndDataScopeMutationAccess`. Plain `getPermissionAccess` checks permission only — no row filter.
|
|
107
|
+
|
|
108
|
+
**What you need in your app collections:**
|
|
109
|
+
|
|
110
|
+
1. A field storing the creator (default: `createdBy` → relationship to `users`)
|
|
111
|
+
2. Set it on create (hook or default value)
|
|
112
|
+
3. Pass `options: { createdByField: "createdBy" }` to data-scope helpers
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
// posts collection — read filtered by dataScope
|
|
116
|
+
read: getPermissionAndDataScopeReadAccess({
|
|
117
|
+
featureCode: "posts",
|
|
118
|
+
actionCode: "read",
|
|
119
|
+
options: { createdByField: "createdBy" },
|
|
120
|
+
}),
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Users collection:** the plugin uses `createdByField: "id"` (each user document is “owned” by itself) and adds `parent` / `parentPath` for hierarchy. See [UTILS](./UTILS.md) for full helper reference.
|
|
124
|
+
|
|
125
|
+
**Super admin (`isSuperAdmin`):** bypasses permission checks **and** data scope on every helper. Use sparingly for platform administrators — not for everyday business roles. Set via seed/Local API only (`isSuperAdmin` is read-only in Admin).
|
|
126
|
+
|
|
127
|
+
**How the permission matrix works:**
|
|
128
|
+
|
|
129
|
+
1. Admin toggles checkboxes → updates `permissionMatrixDraft` on the form
|
|
130
|
+
2. **Save role** → `afterChange` hook syncs to `roles-permissions`
|
|
131
|
+
3. Runtime RBAC reads **`roles-permissions`**, not the JSON draft
|
|
132
|
+
|
|
133
|
+
**Field name vs translation key:** the schema field is `permissionMatrixDraft`; the translation label key is `permissionMatrix`:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
translations: {
|
|
137
|
+
en: {
|
|
138
|
+
collections: {
|
|
139
|
+
roles: {
|
|
140
|
+
fields: {
|
|
141
|
+
permissionMatrix: { label: "Permission Matrix" }, // label for permissionMatrixDraft
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### `roles-permissions`
|
|
150
|
+
|
|
151
|
+
| Field | Description |
|
|
152
|
+
|-------|-------------|
|
|
153
|
+
| `role` | → `roles` |
|
|
154
|
+
| `permission` | → `permissions` |
|
|
155
|
+
| `enabled` | Grant on/off (default `true`) |
|
|
156
|
+
|
|
157
|
+
Managed via the matrix on the role edit screen — you normally do not open this collection in Admin.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Users collection
|
|
162
|
+
|
|
163
|
+
The plugin does **not** add a separate users collection. It **augments** the collection referenced by `config.admin.user` (default: `users`).
|
|
164
|
+
|
|
165
|
+
Toggle with `autoModifyUsersCollection` (default: `true`).
|
|
166
|
+
|
|
167
|
+
### Fields the plugin adds
|
|
168
|
+
|
|
169
|
+
| Field | Description |
|
|
170
|
+
|-------|-------------|
|
|
171
|
+
| `isSuperAdmin` | Bypasses all checks; **read-only** in Admin |
|
|
172
|
+
| `roles` | hasMany relationship → `roles` |
|
|
173
|
+
| `parent` | Relationship to parent user (for `hierarchy` scope) |
|
|
174
|
+
| `parentPath` | Hidden, auto-maintained — used for hierarchy lookups |
|
|
175
|
+
|
|
176
|
+
### Default access on users
|
|
177
|
+
|
|
178
|
+
`featureCode` = users collection slug (e.g. `"users"`).
|
|
179
|
+
|
|
180
|
+
| Operation | `actionCode` |
|
|
181
|
+
|-----------|--------------|
|
|
182
|
+
| `create` | `create` |
|
|
183
|
+
| `read` | `read` (+ data scope) |
|
|
184
|
+
| `update` | `update` (+ data scope) |
|
|
185
|
+
| `delete` | `delete` (+ data scope) |
|
|
186
|
+
| `readVersions` | `readVersions` |
|
|
187
|
+
| `unlock` | `unlock` |
|
|
188
|
+
|
|
189
|
+
Seed a `permission-features` record with `code` equal to the users slug, plus matching actions and permissions.
|
|
190
|
+
|
|
191
|
+
**Your access overrides the plugin:** spread order is `{ ...pluginDefaults, ...yourAccess }` — your handler wins for the same operation.
|
|
192
|
+
|
|
193
|
+
### Bootstrap super admin
|
|
194
|
+
|
|
195
|
+
`isSuperAdmin` cannot be set in the Admin UI. Use a seed script or Local API:
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
await payload.update({
|
|
199
|
+
collection: "users",
|
|
200
|
+
id: userId,
|
|
201
|
+
data: { isSuperAdmin: true },
|
|
202
|
+
overrideAccess: true,
|
|
203
|
+
});
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Customizing collections
|
|
209
|
+
|
|
210
|
+
Pass overrides under `collections` in plugin config:
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
import {
|
|
214
|
+
getPermissionAccess,
|
|
215
|
+
payloadAuthRbacPlugin,
|
|
216
|
+
} from "@zealamic/payload-auth-rbac-plugin";
|
|
217
|
+
|
|
218
|
+
export default buildConfig({
|
|
219
|
+
plugins: [
|
|
220
|
+
payloadAuthRbacPlugin({
|
|
221
|
+
autoModifyUsersCollection: true,
|
|
222
|
+
collections: {
|
|
223
|
+
permissionActions: { /* ... */ },
|
|
224
|
+
permissionFeatures: { /* ... */ },
|
|
225
|
+
permissions: { /* ... */ },
|
|
226
|
+
roles: { /* ... */ },
|
|
227
|
+
rolesPermissions: { /* ... */ },
|
|
228
|
+
},
|
|
229
|
+
translations: {
|
|
230
|
+
/* label i18n — see TRANSLATIONS.md */
|
|
231
|
+
},
|
|
232
|
+
}),
|
|
233
|
+
],
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### What you can override
|
|
238
|
+
|
|
239
|
+
| Property | Effect |
|
|
240
|
+
|----------|--------|
|
|
241
|
+
| `fields` | Add fields or merge with defaults **by field name** |
|
|
242
|
+
| `access` | Override access handlers (spread after defaults) |
|
|
243
|
+
| `labels` | Collection singular/plural labels |
|
|
244
|
+
| `admin` | Group, columns, hidden, etc. |
|
|
245
|
+
|
|
246
|
+
### Field merge rules
|
|
247
|
+
|
|
248
|
+
- **Same `name`** → shallow merge `{ ...pluginField, ...yourField }`
|
|
249
|
+
- **New name** → appended after defaults
|
|
250
|
+
- **Wrong name** → duplicate field — always match existing names exactly
|
|
251
|
+
|
|
252
|
+
`admin`, `hooks`, and `validate` on a field override **replace** the plugin field's values entirely (no deep merge).
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Customization examples
|
|
257
|
+
|
|
258
|
+
### 1. Hide a field in Admin
|
|
259
|
+
|
|
260
|
+
```ts
|
|
261
|
+
collections: {
|
|
262
|
+
permissionActions: {
|
|
263
|
+
fields: [
|
|
264
|
+
{
|
|
265
|
+
name: "sortOrder",
|
|
266
|
+
type: "number",
|
|
267
|
+
admin: { hidden: true },
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### 2. Let non–super-admins read/update permission-actions
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
collections: {
|
|
278
|
+
permissionActions: {
|
|
279
|
+
access: {
|
|
280
|
+
read: getPermissionAccess({
|
|
281
|
+
featureCode: "permission-actions",
|
|
282
|
+
actionCode: "read",
|
|
283
|
+
}),
|
|
284
|
+
update: getPermissionAccess({
|
|
285
|
+
featureCode: "permission-actions",
|
|
286
|
+
actionCode: "update",
|
|
287
|
+
}),
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
Requires matching `permission-features`, `permission-actions`, and `permissions` records in the database.
|
|
294
|
+
|
|
295
|
+
### 3. Change role list columns
|
|
296
|
+
|
|
297
|
+
```ts
|
|
298
|
+
collections: {
|
|
299
|
+
roles: {
|
|
300
|
+
admin: {
|
|
301
|
+
defaultColumns: ["code", "name", "dataScope", "status"],
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### 4. Add a custom field to roles
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
collections: {
|
|
311
|
+
roles: {
|
|
312
|
+
fields: [
|
|
313
|
+
{
|
|
314
|
+
name: "department",
|
|
315
|
+
type: "text",
|
|
316
|
+
admin: { position: "sidebar" },
|
|
317
|
+
},
|
|
318
|
+
],
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### 5. Expose `roles-permissions` for debugging
|
|
324
|
+
|
|
325
|
+
```ts
|
|
326
|
+
collections: {
|
|
327
|
+
rolesPermissions: {
|
|
328
|
+
admin: { hidden: false },
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### 6. Translate user field labels (not via `collections.users`)
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
payloadAuthRbacPlugin({
|
|
337
|
+
translations: {
|
|
338
|
+
en: {
|
|
339
|
+
collections: {
|
|
340
|
+
users: {
|
|
341
|
+
fields: {
|
|
342
|
+
roles: { label: "Assigned Roles" },
|
|
343
|
+
isSuperAdmin: { label: "Super Admin" },
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
});
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### 7. Custom users slug (`admin.user`)
|
|
353
|
+
|
|
354
|
+
```ts
|
|
355
|
+
export default buildConfig({
|
|
356
|
+
admin: { user: "members" },
|
|
357
|
+
plugins: [payloadAuthRbacPlugin({ autoModifyUsersCollection: true })],
|
|
358
|
+
collections: [
|
|
359
|
+
{ slug: "members", auth: true, fields: [{ name: "email", type: "email", required: true }] },
|
|
360
|
+
],
|
|
361
|
+
});
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Seed `permission-features` with `code: "members"` to match the slug.
|
|
365
|
+
|
|
366
|
+
### 8. Disable auto-modify users
|
|
367
|
+
|
|
368
|
+
```ts
|
|
369
|
+
payloadAuthRbacPlugin({
|
|
370
|
+
autoModifyUsersCollection: false,
|
|
371
|
+
})
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
You must add `roles`, `isSuperAdmin`, and wire `getPermissionAccess` on the users collection yourself.
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## Quick setup checklist
|
|
379
|
+
|
|
380
|
+
1. Register the plugin in `payload.config.ts`
|
|
381
|
+
2. Seed **permission-features** (`users`, `posts`, …)
|
|
382
|
+
3. Seed **permission-actions** (`create`, `read`, `update`, `delete`, …)
|
|
383
|
+
4. Create **permissions** (one row per feature + action pair)
|
|
384
|
+
5. Create **roles**, configure the matrix, and Save
|
|
385
|
+
6. Assign **roles** to users
|
|
386
|
+
7. Bootstrap a **super admin** (seed / DB)
|
|
387
|
+
8. Apply access helpers on app collections — see [UTILS](./UTILS.md)
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## Deletes and referential integrity
|
|
392
|
+
|
|
393
|
+
The plugin does **not** cascade deletes. Recommended:
|
|
394
|
+
|
|
395
|
+
- Prefer `status: inactive` over deleting features, actions, or permissions
|
|
396
|
+
- Before deleting a role: remove it from users and delete related `roles-permissions` rows
|
|
397
|
+
|
|
398
|
+
```ts
|
|
399
|
+
// Example: clean join rows when a role is deleted
|
|
400
|
+
hooks: {
|
|
401
|
+
beforeDelete: [
|
|
402
|
+
async ({ id, req }) => {
|
|
403
|
+
await req.payload.delete({
|
|
404
|
+
collection: "roles-permissions",
|
|
405
|
+
where: { role: { equals: id } },
|
|
406
|
+
req,
|
|
407
|
+
});
|
|
408
|
+
},
|
|
409
|
+
],
|
|
410
|
+
},
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## Quick reference
|
|
416
|
+
|
|
417
|
+
| Goal | Use |
|
|
418
|
+
|------|-----|
|
|
419
|
+
| Translate labels | `translations` → [TRANSLATIONS](./TRANSLATIONS.md) |
|
|
420
|
+
| Hide / extend fields | `collections.<key>.fields` |
|
|
421
|
+
| Change who can CRUD | `collections.<key>.access` |
|
|
422
|
+
| Access helpers | [UTILS](./UTILS.md) |
|
|
423
|
+
| Setup & plugin config | [README](../README.md) |
|
|
424
|
+
| Disable users modification | `autoModifyUsersCollection: false` |
|
|
425
|
+
|
|
426
|
+
Working demos: `dev/rbac.ts`, `dev/collections/posts.ts`.
|