roles-privileges-payload-plugin 1.0.2 → 1.1.2

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.
Files changed (50) hide show
  1. package/README.md +5 -1
  2. package/dist/collections/roles.d.ts +32 -0
  3. package/dist/collections/roles.js +122 -0
  4. package/dist/collections/roles.js.map +1 -0
  5. package/dist/components/PrivilegesSelect.d.ts +19 -0
  6. package/dist/components/PrivilegesSelect.js +471 -0
  7. package/dist/components/PrivilegesSelect.js.map +1 -0
  8. package/dist/exports/client.d.ts +2 -0
  9. package/dist/exports/client.js +3 -0
  10. package/dist/exports/client.js.map +1 -0
  11. package/dist/exports/rsc.d.ts +1 -0
  12. package/dist/exports/rsc.js +3 -0
  13. package/dist/exports/rsc.js.map +1 -0
  14. package/dist/exports/types.d.ts +3 -0
  15. package/dist/exports/types.js +5 -0
  16. package/dist/exports/types.js.map +1 -0
  17. package/dist/exports/utilities.d.ts +6 -0
  18. package/dist/exports/utilities.js +14 -0
  19. package/dist/exports/utilities.js.map +1 -0
  20. package/dist/index.d.ts +19 -0
  21. package/dist/index.js +179 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/translations/index.d.ts +7 -0
  24. package/dist/translations/index.js +50 -0
  25. package/dist/translations/index.js.map +1 -0
  26. package/dist/translations/languages/en.d.ts +2 -0
  27. package/dist/translations/languages/en.js +76 -0
  28. package/dist/translations/languages/en.js.map +1 -0
  29. package/dist/translations/languages/fr.d.ts +2 -0
  30. package/dist/translations/languages/fr.js +76 -0
  31. package/dist/translations/languages/fr.js.map +1 -0
  32. package/dist/translations/types.d.ts +67 -0
  33. package/dist/translations/types.js +3 -0
  34. package/dist/translations/types.js.map +1 -0
  35. package/dist/utils/createCustomPrivilege.d.ts +89 -0
  36. package/dist/utils/createCustomPrivilege.js +77 -0
  37. package/dist/utils/createCustomPrivilege.js.map +1 -0
  38. package/dist/utils/generateGlobalPrivileges.d.ts +48 -0
  39. package/dist/utils/generateGlobalPrivileges.js +133 -0
  40. package/dist/utils/generateGlobalPrivileges.js.map +1 -0
  41. package/dist/utils/generatePrivileges.d.ts +51 -0
  42. package/dist/utils/generatePrivileges.js +162 -0
  43. package/dist/utils/generatePrivileges.js.map +1 -0
  44. package/dist/utils/privilegesAccess.d.ts +71 -0
  45. package/dist/utils/privilegesAccess.js +144 -0
  46. package/dist/utils/privilegesAccess.js.map +1 -0
  47. package/dist/utils/seedSuperAdminRole.d.ts +6 -0
  48. package/dist/utils/seedSuperAdminRole.js +60 -0
  49. package/dist/utils/seedSuperAdminRole.js.map +1 -0
  50. package/package.json +18 -15
@@ -0,0 +1,471 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Collapsible, useField, useForm, useFormFields, useTranslation } from '@payloadcms/ui';
4
+ import { memo, useCallback } from 'react';
5
+ /**
6
+ * Custom array field component for managing privileges in Payload CMS
7
+ * @component
8
+ * @param {Object} props - Component props from Payload CMS
9
+ * @param {string} props.path - Path to the field in the form
10
+ * @param {CollectionPrivileges[]} props.collections - Collections with their privileges
11
+ * @param {GlobalPrivileges[]} props.globals - Globals with their privileges
12
+ */ const PrivilegesSelect = (props)=>{
13
+ const { path, collections = [], globals = [] } = props;
14
+ const { rows } = useField({
15
+ path,
16
+ hasRows: true
17
+ });
18
+ const { addFieldRow, removeFieldRow, setModified } = useForm();
19
+ const { dispatch } = useFormFields(([_, dispatch])=>({
20
+ dispatch
21
+ }));
22
+ const { i18n } = useTranslation();
23
+ const locale = i18n?.language || 'en';
24
+ // Helper to get label in current locale with fallback
25
+ const getLabel = (labels)=>{
26
+ return labels[locale] || labels._default || labels.en || Object.values(labels)[0] || '';
27
+ };
28
+ // Use the collections and globals from props
29
+ const collectionsArray = collections;
30
+ const globalsArray = globals;
31
+ /**
32
+ * Get existing privilege values from form fields
33
+ */ const existingPrivileges = useFormFields(([fields])=>rows?.map((row, index)=>{
34
+ const value = fields[`${path}.${index}.privilege`]?.value;
35
+ return typeof value === 'string' ? value : '';
36
+ }) || []);
37
+ /**
38
+ * Get privilege label from privilegeKey
39
+ */ const getPrivilegeLabel = useCallback((privilegeKey)=>{
40
+ // Check collections
41
+ for (const collection of collectionsArray){
42
+ for (const privilege of Object.values(collection.privileges)){
43
+ if (privilege.privilegeKey === privilegeKey) {
44
+ return getLabel(privilege.label);
45
+ }
46
+ }
47
+ }
48
+ // Check globals
49
+ for (const global of globalsArray){
50
+ for (const privilege of Object.values(global.privileges)){
51
+ if (privilege.privilegeKey === privilegeKey) {
52
+ return getLabel(privilege.label);
53
+ }
54
+ }
55
+ }
56
+ return privilegeKey;
57
+ }, [
58
+ collectionsArray,
59
+ globalsArray,
60
+ locale
61
+ ]);
62
+ /**
63
+ * Check if a privilege is already selected
64
+ */ const isPrivilegeSelected = useCallback((privilegeName)=>{
65
+ return existingPrivileges.includes(privilegeName);
66
+ }, [
67
+ existingPrivileges
68
+ ]);
69
+ /**
70
+ * Handles privilege selection/deselection
71
+ */ const handlePrivilegeToggle = useCallback((privilege)=>{
72
+ const privilegeKey = privilege.privilegeKey;
73
+ const existingIndex = existingPrivileges.indexOf(privilegeKey);
74
+ if (existingIndex >= 0) {
75
+ // Remove privilege
76
+ removeFieldRow({
77
+ path,
78
+ rowIndex: existingIndex
79
+ });
80
+ setModified(true);
81
+ } else {
82
+ // Add privilege
83
+ addFieldRow({
84
+ path,
85
+ schemaPath: `${path}.0.privilege`
86
+ });
87
+ setTimeout(()=>{
88
+ dispatch({
89
+ type: 'UPDATE',
90
+ path: `${path}.${rows?.length || 0}.privilege`,
91
+ value: privilegeKey
92
+ });
93
+ setModified(true);
94
+ }, 0);
95
+ }
96
+ }, [
97
+ addFieldRow,
98
+ dispatch,
99
+ existingPrivileges,
100
+ path,
101
+ removeFieldRow,
102
+ rows?.length,
103
+ setModified
104
+ ]);
105
+ return /*#__PURE__*/ _jsxs("div", {
106
+ style: {
107
+ marginTop: '16px',
108
+ marginBottom: '16px'
109
+ },
110
+ children: [
111
+ /*#__PURE__*/ _jsxs("div", {
112
+ style: {
113
+ display: 'flex',
114
+ flexDirection: 'column',
115
+ gap: '8px'
116
+ },
117
+ children: [
118
+ collectionsArray.map((collection)=>{
119
+ const privileges = Object.values(collection.privileges);
120
+ const selectedCount = privileges.filter((p)=>isPrivilegeSelected(p.privilegeKey)).length;
121
+ return /*#__PURE__*/ _jsx(Collapsible, {
122
+ header: /*#__PURE__*/ _jsxs("div", {
123
+ style: {
124
+ display: 'flex',
125
+ alignItems: 'center',
126
+ justifyContent: 'space-between',
127
+ width: '100%'
128
+ },
129
+ children: [
130
+ /*#__PURE__*/ _jsxs("div", {
131
+ style: {
132
+ display: 'flex',
133
+ alignItems: 'center',
134
+ gap: '8px'
135
+ },
136
+ children: [
137
+ /*#__PURE__*/ _jsx("span", {
138
+ children: "📦"
139
+ }),
140
+ /*#__PURE__*/ _jsx("span", {
141
+ style: {
142
+ fontWeight: 500
143
+ },
144
+ children: getLabel(collection.collectionLabel) || collection.collectionSlug
145
+ })
146
+ ]
147
+ }),
148
+ selectedCount > 0 && /*#__PURE__*/ _jsx("span", {
149
+ style: {
150
+ padding: '2px 8px',
151
+ backgroundColor: 'var(--theme-success-100)',
152
+ color: 'var(--theme-success-800)',
153
+ borderRadius: '12px',
154
+ fontSize: '12px',
155
+ fontWeight: 600
156
+ },
157
+ children: selectedCount
158
+ })
159
+ ]
160
+ }),
161
+ children: /*#__PURE__*/ _jsx("div", {
162
+ style: {
163
+ padding: '16px',
164
+ backgroundColor: 'var(--theme-elevation-50)',
165
+ display: 'flex',
166
+ flexDirection: 'column',
167
+ gap: '12px'
168
+ },
169
+ children: privileges.map((privilege)=>{
170
+ const isSelected = isPrivilegeSelected(privilege.privilegeKey);
171
+ const isCustom = privilege.isCustom === true;
172
+ return /*#__PURE__*/ _jsx("div", {
173
+ style: {
174
+ padding: '12px',
175
+ backgroundColor: 'var(--theme-elevation-0)',
176
+ border: `1px solid ${isSelected ? 'var(--theme-success-300)' : 'var(--theme-elevation-300)'}`,
177
+ borderRadius: '4px',
178
+ transition: 'all 0.2s'
179
+ },
180
+ children: /*#__PURE__*/ _jsxs("label", {
181
+ style: {
182
+ display: 'flex',
183
+ alignItems: 'flex-start',
184
+ gap: '12px',
185
+ cursor: 'pointer'
186
+ },
187
+ children: [
188
+ /*#__PURE__*/ _jsx("input", {
189
+ type: "checkbox",
190
+ checked: isSelected,
191
+ onChange: ()=>handlePrivilegeToggle(privilege),
192
+ style: {
193
+ marginTop: '2px',
194
+ cursor: 'pointer'
195
+ }
196
+ }),
197
+ /*#__PURE__*/ _jsxs("div", {
198
+ style: {
199
+ flex: 1
200
+ },
201
+ children: [
202
+ /*#__PURE__*/ _jsxs("div", {
203
+ style: {
204
+ fontWeight: 600,
205
+ fontSize: '14px',
206
+ color: 'var(--theme-elevation-1000)',
207
+ marginBottom: '4px',
208
+ display: 'flex',
209
+ alignItems: 'center',
210
+ gap: '6px'
211
+ },
212
+ children: [
213
+ isCustom && /*#__PURE__*/ _jsx("span", {
214
+ style: {
215
+ fontSize: '16px'
216
+ },
217
+ children: "⭐"
218
+ }),
219
+ getLabel(privilege.label)
220
+ ]
221
+ }),
222
+ /*#__PURE__*/ _jsx("div", {
223
+ style: {
224
+ fontSize: '13px',
225
+ color: 'var(--theme-elevation-700)',
226
+ lineHeight: '1.4',
227
+ marginBottom: '8px'
228
+ },
229
+ children: getLabel(privilege.description)
230
+ }),
231
+ /*#__PURE__*/ _jsxs("div", {
232
+ style: {
233
+ padding: '4px 8px',
234
+ backgroundColor: isCustom ? 'var(--theme-warning-100)' : 'var(--theme-elevation-100)',
235
+ borderRadius: '4px',
236
+ fontSize: '11px',
237
+ fontFamily: 'monospace',
238
+ color: isCustom ? 'var(--theme-warning-900)' : 'var(--theme-elevation-800)',
239
+ display: 'inline-block'
240
+ },
241
+ children: [
242
+ isCustom && '⭐ ',
243
+ privilege.privilegeKey
244
+ ]
245
+ })
246
+ ]
247
+ })
248
+ ]
249
+ })
250
+ }, privilege.privilegeKey);
251
+ })
252
+ })
253
+ }, collection.collectionSlug);
254
+ }),
255
+ globalsArray.map((global)=>{
256
+ const privileges = Object.values(global.privileges);
257
+ const selectedCount = privileges.filter((p)=>isPrivilegeSelected(p.privilegeKey)).length;
258
+ return /*#__PURE__*/ _jsx(Collapsible, {
259
+ header: /*#__PURE__*/ _jsxs("div", {
260
+ style: {
261
+ display: 'flex',
262
+ alignItems: 'center',
263
+ justifyContent: 'space-between',
264
+ width: '100%'
265
+ },
266
+ children: [
267
+ /*#__PURE__*/ _jsxs("div", {
268
+ style: {
269
+ display: 'flex',
270
+ alignItems: 'center',
271
+ gap: '8px'
272
+ },
273
+ children: [
274
+ /*#__PURE__*/ _jsx("span", {
275
+ children: "🌐"
276
+ }),
277
+ /*#__PURE__*/ _jsx("span", {
278
+ style: {
279
+ fontWeight: 500
280
+ },
281
+ children: getLabel(global.globalLabel) || global.globalSlug
282
+ })
283
+ ]
284
+ }),
285
+ selectedCount > 0 && /*#__PURE__*/ _jsx("span", {
286
+ style: {
287
+ padding: '2px 8px',
288
+ backgroundColor: 'var(--theme-success-100)',
289
+ color: 'var(--theme-success-800)',
290
+ borderRadius: '12px',
291
+ fontSize: '12px',
292
+ fontWeight: 600
293
+ },
294
+ children: selectedCount
295
+ })
296
+ ]
297
+ }),
298
+ children: /*#__PURE__*/ _jsx("div", {
299
+ style: {
300
+ padding: '16px',
301
+ backgroundColor: 'var(--theme-elevation-50)',
302
+ display: 'flex',
303
+ flexDirection: 'column',
304
+ gap: '12px'
305
+ },
306
+ children: privileges.map((privilege)=>{
307
+ const isSelected = isPrivilegeSelected(privilege.privilegeKey);
308
+ const isCustom = privilege.isCustom === true;
309
+ return /*#__PURE__*/ _jsx("div", {
310
+ style: {
311
+ padding: '12px',
312
+ backgroundColor: 'var(--theme-elevation-0)',
313
+ border: `1px solid ${isSelected ? 'var(--theme-success-300)' : 'var(--theme-elevation-300)'}`,
314
+ borderRadius: '4px',
315
+ transition: 'all 0.2s'
316
+ },
317
+ children: /*#__PURE__*/ _jsxs("label", {
318
+ style: {
319
+ display: 'flex',
320
+ alignItems: 'flex-start',
321
+ gap: '12px',
322
+ cursor: 'pointer'
323
+ },
324
+ children: [
325
+ /*#__PURE__*/ _jsx("input", {
326
+ type: "checkbox",
327
+ checked: isSelected,
328
+ onChange: ()=>handlePrivilegeToggle(privilege),
329
+ style: {
330
+ marginTop: '2px',
331
+ cursor: 'pointer'
332
+ }
333
+ }),
334
+ /*#__PURE__*/ _jsxs("div", {
335
+ style: {
336
+ flex: 1
337
+ },
338
+ children: [
339
+ /*#__PURE__*/ _jsxs("div", {
340
+ style: {
341
+ fontWeight: 600,
342
+ fontSize: '14px',
343
+ color: 'var(--theme-elevation-1000)',
344
+ marginBottom: '4px',
345
+ display: 'flex',
346
+ alignItems: 'center',
347
+ gap: '6px'
348
+ },
349
+ children: [
350
+ isCustom && /*#__PURE__*/ _jsx("span", {
351
+ style: {
352
+ fontSize: '16px'
353
+ },
354
+ children: "⭐"
355
+ }),
356
+ getLabel(privilege.label)
357
+ ]
358
+ }),
359
+ /*#__PURE__*/ _jsx("div", {
360
+ style: {
361
+ fontSize: '13px',
362
+ color: 'var(--theme-elevation-700)',
363
+ lineHeight: '1.4',
364
+ marginBottom: '8px'
365
+ },
366
+ children: getLabel(privilege.description)
367
+ }),
368
+ /*#__PURE__*/ _jsxs("div", {
369
+ style: {
370
+ padding: '4px 8px',
371
+ backgroundColor: isCustom ? 'var(--theme-warning-100)' : 'var(--theme-elevation-100)',
372
+ borderRadius: '4px',
373
+ fontSize: '11px',
374
+ fontFamily: 'monospace',
375
+ color: isCustom ? 'var(--theme-warning-900)' : 'var(--theme-elevation-800)',
376
+ display: 'inline-block'
377
+ },
378
+ children: [
379
+ isCustom && '⭐ ',
380
+ privilege.privilegeKey
381
+ ]
382
+ })
383
+ ]
384
+ })
385
+ ]
386
+ })
387
+ }, privilege.privilegeKey);
388
+ })
389
+ })
390
+ }, global.globalSlug);
391
+ })
392
+ ]
393
+ }),
394
+ existingPrivileges.length > 0 && /*#__PURE__*/ _jsxs("div", {
395
+ style: {
396
+ marginTop: '16px',
397
+ padding: '16px',
398
+ backgroundColor: 'var(--theme-elevation-100)',
399
+ borderRadius: '4px'
400
+ },
401
+ children: [
402
+ /*#__PURE__*/ _jsxs("h5", {
403
+ style: {
404
+ margin: '0 0 12px 0',
405
+ fontSize: '14px',
406
+ fontWeight: 600,
407
+ color: 'var(--theme-elevation-1000)'
408
+ },
409
+ children: [
410
+ i18n.t('plugin-roles-privileges:privileges-selected-count'),
411
+ ' ',
412
+ "(",
413
+ existingPrivileges.length,
414
+ ")"
415
+ ]
416
+ }),
417
+ /*#__PURE__*/ _jsx("div", {
418
+ style: {
419
+ display: 'flex',
420
+ flexWrap: 'wrap',
421
+ gap: '8px'
422
+ },
423
+ children: existingPrivileges.map((privilegeKey, index)=>/*#__PURE__*/ _jsxs("div", {
424
+ style: {
425
+ display: 'inline-flex',
426
+ alignItems: 'center',
427
+ gap: '8px',
428
+ padding: '6px 12px',
429
+ backgroundColor: 'var(--theme-success-100)',
430
+ border: '1px solid var(--theme-success-300)',
431
+ borderRadius: '16px',
432
+ fontSize: '12px',
433
+ color: 'var(--theme-success-800)'
434
+ },
435
+ children: [
436
+ /*#__PURE__*/ _jsx("span", {
437
+ children: getPrivilegeLabel(privilegeKey)
438
+ }),
439
+ /*#__PURE__*/ _jsx("button", {
440
+ type: "button",
441
+ onClick: ()=>{
442
+ removeFieldRow({
443
+ path,
444
+ rowIndex: index
445
+ });
446
+ setModified(true);
447
+ },
448
+ style: {
449
+ background: 'none',
450
+ border: 'none',
451
+ color: 'var(--theme-success-600)',
452
+ cursor: 'pointer',
453
+ padding: 0,
454
+ display: 'flex',
455
+ alignItems: 'center',
456
+ fontSize: '16px',
457
+ lineHeight: 1
458
+ },
459
+ children: "×"
460
+ })
461
+ ]
462
+ }, `${privilegeKey}-${index}`))
463
+ })
464
+ ]
465
+ })
466
+ ]
467
+ });
468
+ };
469
+ export default /*#__PURE__*/ memo(PrivilegesSelect);
470
+
471
+ //# sourceMappingURL=PrivilegesSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/PrivilegesSelect.tsx"],"sourcesContent":["'use client'\nimport type { ArrayFieldClientComponent } from 'payload'\n\nimport { Collapsible, useField, useForm, useFormFields, useTranslation } from '@payloadcms/ui'\nimport { memo, useCallback } from 'react'\nimport type { GlobalPrivilege } from '../utils/generateGlobalPrivileges.js'\nimport type { Privilege } from '../utils/generatePrivileges.js'\n\ntype CollectionPrivileges = {\n collectionSlug: string\n collectionLabel: Record<string, string>\n privileges: Record<string, Privilege>\n}\n\ntype GlobalPrivileges = {\n globalSlug: string\n globalLabel: Record<string, string>\n privileges: Record<string, GlobalPrivilege>\n}\n\ntype PrivilegesSelectProps = {\n path: string\n collections: CollectionPrivileges[]\n globals: GlobalPrivileges[]\n}\n\n/**\n * Custom array field component for managing privileges in Payload CMS\n * @component\n * @param {Object} props - Component props from Payload CMS\n * @param {string} props.path - Path to the field in the form\n * @param {CollectionPrivileges[]} props.collections - Collections with their privileges\n * @param {GlobalPrivileges[]} props.globals - Globals with their privileges\n */\nconst PrivilegesSelect: ArrayFieldClientComponent = (props) => {\n const { path, collections = [], globals = [] } = props as any\n const { rows } = useField({ path, hasRows: true })\n const { addFieldRow, removeFieldRow, setModified } = useForm()\n const { dispatch } = useFormFields(([_, dispatch]) => ({ dispatch }))\n const { i18n } = useTranslation()\n const locale = i18n?.language || 'en'\n\n // Helper to get label in current locale with fallback\n const getLabel = (labels: Record<string, string>): string => {\n return labels[locale] || labels._default || labels.en || Object.values(labels)[0] || ''\n }\n\n // Use the collections and globals from props\n const collectionsArray = collections\n const globalsArray = globals\n\n /**\n * Get existing privilege values from form fields\n */\n const existingPrivileges = useFormFields(\n ([fields]) =>\n rows?.map((row, index) => {\n const value = fields[`${path}.${index}.privilege`]?.value\n return typeof value === 'string' ? value : ''\n }) || [],\n )\n\n /**\n * Get privilege label from privilegeKey\n */\n const getPrivilegeLabel = useCallback(\n (privilegeKey: string) => {\n // Check collections\n for (const collection of collectionsArray) {\n for (const privilege of Object.values(collection.privileges) as Privilege[]) {\n if (privilege.privilegeKey === privilegeKey) {\n return getLabel(privilege.label)\n }\n }\n }\n // Check globals\n for (const global of globalsArray) {\n for (const privilege of Object.values(global.privileges) as GlobalPrivilege[]) {\n if (privilege.privilegeKey === privilegeKey) {\n return getLabel(privilege.label)\n }\n }\n }\n return privilegeKey\n },\n [collectionsArray, globalsArray, locale],\n )\n\n /**\n * Check if a privilege is already selected\n */\n const isPrivilegeSelected = useCallback(\n (privilegeName: string) => {\n return existingPrivileges.includes(privilegeName)\n },\n [existingPrivileges],\n )\n\n /**\n * Handles privilege selection/deselection\n */\n const handlePrivilegeToggle = useCallback(\n (privilege: Privilege | GlobalPrivilege) => {\n const privilegeKey = privilege.privilegeKey\n const existingIndex = existingPrivileges.indexOf(privilegeKey)\n\n if (existingIndex >= 0) {\n // Remove privilege\n removeFieldRow({ path, rowIndex: existingIndex })\n setModified(true)\n } else {\n // Add privilege\n addFieldRow({\n path,\n schemaPath: `${path}.0.privilege`,\n })\n\n setTimeout(() => {\n dispatch({\n type: 'UPDATE',\n path: `${path}.${rows?.length || 0}.privilege`,\n value: privilegeKey,\n })\n setModified(true)\n }, 0)\n }\n },\n [addFieldRow, dispatch, existingPrivileges, path, removeFieldRow, rows?.length, setModified],\n )\n\n return (\n <div style={{ marginTop: '16px', marginBottom: '16px' }}>\n <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>\n {/* Collections */}\n {collectionsArray.map((collection: CollectionPrivileges) => {\n const privileges = Object.values(collection.privileges) as Privilege[]\n const selectedCount = privileges.filter((p) => isPrivilegeSelected(p.privilegeKey)).length\n\n return (\n <Collapsible\n key={collection.collectionSlug}\n header={\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n width: '100%',\n }}\n >\n <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>\n <span>📦</span>\n <span style={{ fontWeight: 500 }}>\n {getLabel(collection.collectionLabel) || collection.collectionSlug}\n </span>\n </div>\n {selectedCount > 0 && (\n <span\n style={{\n padding: '2px 8px',\n backgroundColor: 'var(--theme-success-100)',\n color: 'var(--theme-success-800)',\n borderRadius: '12px',\n fontSize: '12px',\n fontWeight: 600,\n }}\n >\n {selectedCount}\n </span>\n )}\n </div>\n }\n >\n <div\n style={{\n padding: '16px',\n backgroundColor: 'var(--theme-elevation-50)',\n display: 'flex',\n flexDirection: 'column',\n gap: '12px',\n }}\n >\n {privileges.map((privilege) => {\n const isSelected = isPrivilegeSelected(privilege.privilegeKey)\n const isCustom = privilege.isCustom === true\n return (\n <div\n key={privilege.privilegeKey}\n style={{\n padding: '12px',\n backgroundColor: 'var(--theme-elevation-0)',\n border: `1px solid ${\n isSelected ? 'var(--theme-success-300)' : 'var(--theme-elevation-300)'\n }`,\n borderRadius: '4px',\n transition: 'all 0.2s',\n }}\n >\n <label\n style={{\n display: 'flex',\n alignItems: 'flex-start',\n gap: '12px',\n cursor: 'pointer',\n }}\n >\n <input\n type=\"checkbox\"\n checked={isSelected}\n onChange={() => handlePrivilegeToggle(privilege)}\n style={{ marginTop: '2px', cursor: 'pointer' }}\n />\n <div style={{ flex: 1 }}>\n <div\n style={{\n fontWeight: 600,\n fontSize: '14px',\n color: 'var(--theme-elevation-1000)',\n marginBottom: '4px',\n display: 'flex',\n alignItems: 'center',\n gap: '6px',\n }}\n >\n {isCustom && <span style={{ fontSize: '16px' }}>⭐</span>}\n {getLabel(privilege.label)}\n </div>\n <div\n style={{\n fontSize: '13px',\n color: 'var(--theme-elevation-700)',\n lineHeight: '1.4',\n marginBottom: '8px',\n }}\n >\n {getLabel(privilege.description)}\n </div>\n <div\n style={{\n padding: '4px 8px',\n backgroundColor: isCustom\n ? 'var(--theme-warning-100)'\n : 'var(--theme-elevation-100)',\n borderRadius: '4px',\n fontSize: '11px',\n fontFamily: 'monospace',\n color: isCustom\n ? 'var(--theme-warning-900)'\n : 'var(--theme-elevation-800)',\n display: 'inline-block',\n }}\n >\n {isCustom && '⭐ '}\n {privilege.privilegeKey}\n </div>\n </div>\n </label>\n </div>\n )\n })}\n </div>\n </Collapsible>\n )\n })}\n\n {/* Globals */}\n {globalsArray.map((global: GlobalPrivileges) => {\n const privileges = Object.values(global.privileges) as GlobalPrivilege[]\n const selectedCount = privileges.filter((p) => isPrivilegeSelected(p.privilegeKey)).length\n\n return (\n <Collapsible\n key={global.globalSlug}\n header={\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n width: '100%',\n }}\n >\n <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>\n <span>🌐</span>\n <span style={{ fontWeight: 500 }}>\n {getLabel(global.globalLabel) || global.globalSlug}\n </span>\n </div>\n {selectedCount > 0 && (\n <span\n style={{\n padding: '2px 8px',\n backgroundColor: 'var(--theme-success-100)',\n color: 'var(--theme-success-800)',\n borderRadius: '12px',\n fontSize: '12px',\n fontWeight: 600,\n }}\n >\n {selectedCount}\n </span>\n )}\n </div>\n }\n >\n <div\n style={{\n padding: '16px',\n backgroundColor: 'var(--theme-elevation-50)',\n display: 'flex',\n flexDirection: 'column',\n gap: '12px',\n }}\n >\n {privileges.map((privilege) => {\n const isSelected = isPrivilegeSelected(privilege.privilegeKey)\n const isCustom = privilege.isCustom === true\n return (\n <div\n key={privilege.privilegeKey}\n style={{\n padding: '12px',\n backgroundColor: 'var(--theme-elevation-0)',\n border: `1px solid ${\n isSelected ? 'var(--theme-success-300)' : 'var(--theme-elevation-300)'\n }`,\n borderRadius: '4px',\n transition: 'all 0.2s',\n }}\n >\n <label\n style={{\n display: 'flex',\n alignItems: 'flex-start',\n gap: '12px',\n cursor: 'pointer',\n }}\n >\n <input\n type=\"checkbox\"\n checked={isSelected}\n onChange={() => handlePrivilegeToggle(privilege)}\n style={{ marginTop: '2px', cursor: 'pointer' }}\n />\n <div style={{ flex: 1 }}>\n <div\n style={{\n fontWeight: 600,\n fontSize: '14px',\n color: 'var(--theme-elevation-1000)',\n marginBottom: '4px',\n display: 'flex',\n alignItems: 'center',\n gap: '6px',\n }}\n >\n {isCustom && <span style={{ fontSize: '16px' }}>⭐</span>}\n {getLabel(privilege.label)}\n </div>\n <div\n style={{\n fontSize: '13px',\n color: 'var(--theme-elevation-700)',\n lineHeight: '1.4',\n marginBottom: '8px',\n }}\n >\n {getLabel(privilege.description)}\n </div>\n <div\n style={{\n padding: '4px 8px',\n backgroundColor: isCustom\n ? 'var(--theme-warning-100)'\n : 'var(--theme-elevation-100)',\n borderRadius: '4px',\n fontSize: '11px',\n fontFamily: 'monospace',\n color: isCustom\n ? 'var(--theme-warning-900)'\n : 'var(--theme-elevation-800)',\n display: 'inline-block',\n }}\n >\n {isCustom && '⭐ '}\n {privilege.privilegeKey}\n </div>\n </div>\n </label>\n </div>\n )\n })}\n </div>\n </Collapsible>\n )\n })}\n </div>\n\n {/* Selected Privileges Summary */}\n {existingPrivileges.length > 0 && (\n <div\n style={{\n marginTop: '16px',\n padding: '16px',\n backgroundColor: 'var(--theme-elevation-100)',\n borderRadius: '4px',\n }}\n >\n <h5\n style={{\n margin: '0 0 12px 0',\n fontSize: '14px',\n fontWeight: 600,\n color: 'var(--theme-elevation-1000)',\n }}\n >\n {(i18n.t as (key: string) => string)(\n 'plugin-roles-privileges:privileges-selected-count',\n )}{' '}\n ({existingPrivileges.length})\n </h5>\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: '8px' }}>\n {existingPrivileges.map((privilegeKey, index) => (\n <div\n key={`${privilegeKey}-${index}`}\n style={{\n display: 'inline-flex',\n alignItems: 'center',\n gap: '8px',\n padding: '6px 12px',\n backgroundColor: 'var(--theme-success-100)',\n border: '1px solid var(--theme-success-300)',\n borderRadius: '16px',\n fontSize: '12px',\n color: 'var(--theme-success-800)',\n }}\n >\n <span>{getPrivilegeLabel(privilegeKey)}</span>\n <button\n type=\"button\"\n onClick={() => {\n removeFieldRow({ path, rowIndex: index })\n setModified(true)\n }}\n style={{\n background: 'none',\n border: 'none',\n color: 'var(--theme-success-600)',\n cursor: 'pointer',\n padding: 0,\n display: 'flex',\n alignItems: 'center',\n fontSize: '16px',\n lineHeight: 1,\n }}\n >\n ×\n </button>\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n )\n}\n\nexport default memo(PrivilegesSelect)\nexport type { CollectionPrivileges, GlobalPrivileges }\n"],"names":["Collapsible","useField","useForm","useFormFields","useTranslation","memo","useCallback","PrivilegesSelect","props","path","collections","globals","rows","hasRows","addFieldRow","removeFieldRow","setModified","dispatch","_","i18n","locale","language","getLabel","labels","_default","en","Object","values","collectionsArray","globalsArray","existingPrivileges","fields","map","row","index","value","getPrivilegeLabel","privilegeKey","collection","privilege","privileges","label","global","isPrivilegeSelected","privilegeName","includes","handlePrivilegeToggle","existingIndex","indexOf","rowIndex","schemaPath","setTimeout","type","length","div","style","marginTop","marginBottom","display","flexDirection","gap","selectedCount","filter","p","header","alignItems","justifyContent","width","span","fontWeight","collectionLabel","collectionSlug","padding","backgroundColor","color","borderRadius","fontSize","isSelected","isCustom","border","transition","cursor","input","checked","onChange","flex","lineHeight","description","fontFamily","globalLabel","globalSlug","h5","margin","t","flexWrap","button","onClick","background"],"mappings":"AAAA;;AAGA,SAASA,WAAW,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,aAAa,EAAEC,cAAc,QAAQ,iBAAgB;AAC9F,SAASC,IAAI,EAAEC,WAAW,QAAQ,QAAO;AAsBzC;;;;;;;CAOC,GACD,MAAMC,mBAA8C,CAACC;IACnD,MAAM,EAAEC,IAAI,EAAEC,cAAc,EAAE,EAAEC,UAAU,EAAE,EAAE,GAAGH;IACjD,MAAM,EAAEI,IAAI,EAAE,GAAGX,SAAS;QAAEQ;QAAMI,SAAS;IAAK;IAChD,MAAM,EAAEC,WAAW,EAAEC,cAAc,EAAEC,WAAW,EAAE,GAAGd;IACrD,MAAM,EAAEe,QAAQ,EAAE,GAAGd,cAAc,CAAC,CAAC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kCAE9B,KAACC;wBAAIC,OAAO;4BAAEG,SAAS;4BAAQoC,UAAU;4BAAQlC,KAAK;wBAAM;kCACzD9B,mBAAmBE,GAAG,CAAC,CAACK,cAAcH,sBACrC,MAACoB;gCAECC,OAAO;oCACLG,SAAS;oCACTO,YAAY;oCACZL,KAAK;oCACLY,SAAS;oCACTC,iBAAiB;oCACjBM,QAAQ;oCACRJ,cAAc;oCACdC,UAAU;oCACVF,OAAO;gCACT;;kDAEA,KAACN;kDAAMhC,kBAAkBC;;kDACzB,KAAC0D;wCACC3C,MAAK;wCACL4C,SAAS;4CACPjF,eAAe;gDAAEN;gDAAMwC,UAAUf;4CAAM;4CACvClB,YAAY;wCACd;wCACAuC,OAAO;4CACL0C,YAAY;4CACZlB,QAAQ;4CACRL,OAAO;4CACPO,QAAQ;4CACRT,SAAS;4CACTd,SAAS;4CACTO,YAAY;4CACZW,UAAU;4CACVU,YAAY;wCACd;kDACD;;;+BA/BI,GAAGjD,aAAa,CAAC,EAAEH,OAAO;;;;;;AAyC/C;AAEA,6BAAe7B,KAAKE,kBAAiB"}
@@ -0,0 +1,2 @@
1
+ export { default as PrivilegesSelect } from '../components/PrivilegesSelect.js';
2
+ export type { CollectionPrivileges, GlobalPrivileges } from '../components/PrivilegesSelect.js';
@@ -0,0 +1,3 @@
1
+ export { default as PrivilegesSelect } from '../components/PrivilegesSelect.js';
2
+
3
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["export { default as PrivilegesSelect } from '../components/PrivilegesSelect.js'\nexport type { CollectionPrivileges, GlobalPrivileges } from '../components/PrivilegesSelect.js'\n"],"names":["default","PrivilegesSelect"],"mappings":"AAAA,SAASA,WAAWC,gBAAgB,QAAQ,oCAAmC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ // RSC exports can be added here if needed in the future
2
+
3
+ //# sourceMappingURL=rsc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/exports/rsc.ts"],"sourcesContent":["// RSC exports can be added here if needed in the future\n"],"names":[],"mappings":"AAAA,wDAAwD"}
@@ -0,0 +1,3 @@
1
+ export type { GlobalPrivilege, GlobalPrivileges, GlobalPrivilegeType, } from '../utils/generateGlobalPrivileges.js';
2
+ export type { CollectionPrivileges, Privilege, PrivilegeType } from '../utils/generatePrivileges.js';
3
+ export type { CollectionData, GlobalData } from '../collections/roles.js';
@@ -0,0 +1,5 @@
1
+ // Re-export types for external use
2
+ // Re-export roles collection types
3
+ export { };
4
+
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/exports/types.ts"],"sourcesContent":["// Re-export types for external use\nexport type {\n GlobalPrivilege,\n GlobalPrivileges,\n GlobalPrivilegeType,\n} from '../utils/generateGlobalPrivileges.js'\n\nexport type { CollectionPrivileges, Privilege, PrivilegeType } from '../utils/generatePrivileges.js'\n\n// Re-export roles collection types\nexport type { CollectionData, GlobalData } from '../collections/roles.js'\n"],"names":[],"mappings":"AAAA,mCAAmC;AASnC,mCAAmC;AACnC,WAAyE"}
@@ -0,0 +1,6 @@
1
+ export { checkAllPrivileges, checkAnyPrivilege, checkPrivilege, checkPrivileges, hasAllPrivileges, hasAnyPrivilege, hasPrivilege, privilegesAccess, } from '../utils/privilegesAccess.js';
2
+ export { allPrivilegesMap, generateCollectionPrivileges, generatePrivilegeKey, getAllPrivilegeKeys, getAllPrivileges, } from '../utils/generatePrivileges.js';
3
+ export { allGlobalPrivilegesMap, generateGlobalPrivilegeKey, generateGlobalPrivileges, getAllGlobalPrivilegeKeys, getAllGlobalPrivileges, } from '../utils/generateGlobalPrivileges.js';
4
+ export { customPrivilegesRegistry, registerCustomPrivilege, registerCustomPrivileges, type CustomGlobalPrivilege, type CustomPrivilegeConfig, } from '../utils/createCustomPrivilege.js';
5
+ export { createRolesCollection, ensureSuperAdminDontGetDeleted, ensureSuperAdminDontGetUpdated, } from '../collections/roles.js';
6
+ export { seedSuperAdminRole } from '../utils/seedSuperAdminRole.js';
@@ -0,0 +1,14 @@
1
+ // Re-export utility functions for access control
2
+ export { checkAllPrivileges, checkAnyPrivilege, checkPrivilege, checkPrivileges, hasAllPrivileges, hasAnyPrivilege, hasPrivilege, privilegesAccess } from '../utils/privilegesAccess.js';
3
+ // Re-export collection privilege utilities
4
+ export { allPrivilegesMap, generateCollectionPrivileges, generatePrivilegeKey, getAllPrivilegeKeys, getAllPrivileges } from '../utils/generatePrivileges.js';
5
+ // Re-export global privilege utilities
6
+ export { allGlobalPrivilegesMap, generateGlobalPrivilegeKey, generateGlobalPrivileges, getAllGlobalPrivilegeKeys, getAllGlobalPrivileges } from '../utils/generateGlobalPrivileges.js';
7
+ // Re-export custom privilege registration utilities
8
+ export { customPrivilegesRegistry, registerCustomPrivilege, registerCustomPrivileges } from '../utils/createCustomPrivilege.js';
9
+ // Re-export roles collection creation helper
10
+ export { createRolesCollection, ensureSuperAdminDontGetDeleted, ensureSuperAdminDontGetUpdated } from '../collections/roles.js';
11
+ // Re-export seed super admin utility
12
+ export { seedSuperAdminRole } from '../utils/seedSuperAdminRole.js';
13
+
14
+ //# sourceMappingURL=utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/exports/utilities.ts"],"sourcesContent":["// Re-export utility functions for access control\nexport {\n checkAllPrivileges,\n checkAnyPrivilege,\n checkPrivilege,\n checkPrivileges,\n hasAllPrivileges,\n hasAnyPrivilege,\n hasPrivilege,\n privilegesAccess,\n} from '../utils/privilegesAccess.js'\n\n// Re-export collection privilege utilities\nexport {\n allPrivilegesMap,\n generateCollectionPrivileges,\n generatePrivilegeKey,\n getAllPrivilegeKeys,\n getAllPrivileges,\n} from '../utils/generatePrivileges.js'\n\n// Re-export global privilege utilities\nexport {\n allGlobalPrivilegesMap,\n generateGlobalPrivilegeKey,\n generateGlobalPrivileges,\n getAllGlobalPrivilegeKeys,\n getAllGlobalPrivileges,\n} from '../utils/generateGlobalPrivileges.js'\n\n// Re-export custom privilege registration utilities\nexport {\n customPrivilegesRegistry,\n registerCustomPrivilege,\n registerCustomPrivileges,\n type CustomGlobalPrivilege,\n type CustomPrivilegeConfig,\n} from '../utils/createCustomPrivilege.js'\n\n// Re-export roles collection creation helper\nexport {\n createRolesCollection,\n ensureSuperAdminDontGetDeleted,\n ensureSuperAdminDontGetUpdated,\n} from '../collections/roles.js'\n\n// Re-export seed super admin utility\nexport { seedSuperAdminRole } from '../utils/seedSuperAdminRole.js'\n"],"names":["checkAllPrivileges","checkAnyPrivilege","checkPrivilege","checkPrivileges","hasAllPrivileges","hasAnyPrivilege","hasPrivilege","privilegesAccess","allPrivilegesMap","generateCollectionPrivileges","generatePrivilegeKey","getAllPrivilegeKeys","getAllPrivileges","allGlobalPrivilegesMap","generateGlobalPrivilegeKey","generateGlobalPrivileges","getAllGlobalPrivilegeKeys","getAllGlobalPrivileges","customPrivilegesRegistry","registerCustomPrivilege","registerCustomPrivileges","createRolesCollection","ensureSuperAdminDontGetDeleted","ensureSuperAdminDontGetUpdated","seedSuperAdminRole"],"mappings":"AAAA,iDAAiD;AACjD,SACEA,kBAAkB,EAClBC,iBAAiB,EACjBC,cAAc,EACdC,eAAe,EACfC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,gBAAgB,QACX,+BAA8B;AAErC,2CAA2C;AAC3C,SACEC,gBAAgB,EAChBC,4BAA4B,EAC5BC,oBAAoB,EACpBC,mBAAmB,EACnBC,gBAAgB,QACX,iCAAgC;AAEvC,uCAAuC;AACvC,SACEC,sBAAsB,EACtBC,0BAA0B,EAC1BC,wBAAwB,EACxBC,yBAAyB,EACzBC,sBAAsB,QACjB,uCAAsC;AAE7C,oDAAoD;AACpD,SACEC,wBAAwB,EACxBC,uBAAuB,EACvBC,wBAAwB,QAGnB,oCAAmC;AAE1C,6CAA6C;AAC7C,SACEC,qBAAqB,EACrBC,8BAA8B,EAC9BC,8BAA8B,QACzB,0BAAyB;AAEhC,qCAAqC;AACrC,SAASC,kBAAkB,QAAQ,iCAAgC"}
@@ -0,0 +1,19 @@
1
+ import type { CollectionConfig, Config } from 'payload';
2
+ export type RolesPrivilegesPayloadPluginConfig = {
3
+ enable?: boolean;
4
+ disabled?: boolean;
5
+ excludeCollections?: string[];
6
+ excludeGlobals?: string[];
7
+ wrapCollectionAccess?: boolean;
8
+ wrapGlobalAccess?: boolean;
9
+ seedSuperAdmin?: boolean;
10
+ /**
11
+ * Custom roles collection configuration.
12
+ * If provided, this collection will be used instead of the default one.
13
+ * Use `createRolesCollection` helper to create a base configuration and customize it.
14
+ */
15
+ customRolesCollection?: CollectionConfig;
16
+ };
17
+ export * from './exports/types.js';
18
+ export * from './exports/utilities.js';
19
+ export declare const rolesPrivilegesPayloadPlugin: (pluginOptions?: RolesPrivilegesPayloadPluginConfig) => (config: Config) => Config;