@zealamic/payload-auth-rbac-plugin 1.0.0-beta.1 → 1.0.0-beta.11

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 (52) hide show
  1. package/README.md +27 -31
  2. package/assets/cover-photo.jpg +0 -0
  3. package/dist/collections/permission-actions/default-data.d.ts +2 -0
  4. package/dist/collections/permission-actions/index.d.ts +3 -0
  5. package/dist/collections/permission-actions/types.d.ts +51 -0
  6. package/dist/collections/permission-features/default-data.d.ts +2 -0
  7. package/dist/collections/permission-features/index.d.ts +3 -0
  8. package/dist/collections/permission-features/types.d.ts +43 -0
  9. package/dist/collections/permissions/default-data.d.ts +2 -0
  10. package/dist/collections/permissions/index.d.ts +3 -0
  11. package/dist/collections/permissions/types.d.ts +54 -0
  12. package/dist/collections/roles/default-data.d.ts +2 -0
  13. package/dist/collections/roles/hooks/sync-permission-matrix-draft.d.ts +6 -0
  14. package/dist/collections/roles/index.d.ts +3 -0
  15. package/dist/collections/roles/types.d.ts +53 -0
  16. package/dist/collections/roles-permissions/default-data.d.ts +2 -0
  17. package/dist/collections/roles-permissions/index.d.ts +3 -0
  18. package/dist/collections/roles-permissions/types.d.ts +39 -0
  19. package/dist/collections/users/default-data.d.ts +2 -0
  20. package/dist/collections/users/index.d.ts +3 -0
  21. package/dist/collections/users/parent-path.d.ts +31 -0
  22. package/dist/collections/users/types.d.ts +23 -0
  23. package/dist/components/role-permission-matrix-client/default-data.d.ts +2 -0
  24. package/dist/components/role-permission-matrix-client/default-data.js +2 -1
  25. package/dist/components/role-permission-matrix-client/default-data.js.map +1 -1
  26. package/dist/components/role-permission-matrix-client/index.d.ts +1 -0
  27. package/dist/components/role-permission-matrix-client/index.js +18 -68
  28. package/dist/components/role-permission-matrix-client/index.js.map +1 -1
  29. package/dist/components/role-permission-matrix-client/matrix.module.scss +69 -0
  30. package/dist/components/role-permission-matrix-client/types.d.ts +18 -0
  31. package/dist/endpoints/customEndpointHandler.d.ts +2 -0
  32. package/dist/exports/client.d.ts +1 -0
  33. package/dist/exports/rsc.d.ts +1 -0
  34. package/dist/index.d.ts +5 -0
  35. package/dist/lib/constants/general.d.ts +1 -0
  36. package/dist/lib/constants/index.d.ts +14 -0
  37. package/dist/lib/constants/permission-action.d.ts +8 -0
  38. package/dist/lib/constants/permission-feature.d.ts +4 -0
  39. package/dist/lib/constants/permission.d.ts +4 -0
  40. package/dist/lib/constants/role.d.ts +9 -0
  41. package/dist/lib/constants/user.d.ts +1 -0
  42. package/dist/lib/utils/access.d.ts +76 -0
  43. package/dist/lib/utils/data.d.ts +6 -0
  44. package/dist/lib/utils/fields.d.ts +18 -0
  45. package/dist/lib/utils/index.d.ts +4 -0
  46. package/dist/lib/utils/localization.d.ts +27 -0
  47. package/dist/styles/variables.scss +1 -0
  48. package/dist/types.d.ts +38 -0
  49. package/docs/COLLECTIONS.md +440 -0
  50. package/docs/TRANSLATIONS.md +462 -0
  51. package/docs/UTILS.md +226 -0
  52. package/package.json +21 -4
package/README.md CHANGED
@@ -10,13 +10,13 @@ Permissions live in the database (feature + action), are assigned to roles, and
10
10
 
11
11
  ## Documentation
12
12
 
13
- | Guide | Read when you need to… |
14
- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
15
- | **[COLLECTIONS](./docs/COLLECTIONS.md)** | Understand plugin collections, users augmentation, `dataScope`, permission matrix, and **customize** fields/access/admin |
16
- | **[UTILS](./docs/UTILS.md)** | Wire **access helpers** on your app collections (`getPermissionAccess`, data-scope filters, examples) |
17
- | **[TRANSLATIONS](./docs/TRANSLATIONS.md)** | Localize Admin labels, select options, and permission-matrix UI (`en`, `vi`, …) |
13
+ | Guide | Read when you need to… |
14
+ | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
15
+ | **[COLLECTIONS](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/COLLECTIONS.md)** | Understand plugin collections, users augmentation, `dataScope`, permission matrix, and **customize** fields/access/admin |
16
+ | **[UTILS](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/UTILS.md)** | Wire **access helpers** on your app collections (`getPermissionAccess`, data-scope filters, examples) |
17
+ | **[TRANSLATIONS](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/TRANSLATIONS.md)** | Localize Admin labels, select options, and permission-matrix UI (`en`, `vi`, …) |
18
18
 
19
- **Typical flow:** install → register plugin → seed RBAC data ([COLLECTIONS](./docs/COLLECTIONS.md)) → protect app collections ([UTILS](./docs/UTILS.md)) → translate Admin UI ([TRANSLATIONS](./docs/TRANSLATIONS.md)).
19
+ **Typical flow:** install → register plugin → seed RBAC data ([COLLECTIONS](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/COLLECTIONS.md)) → protect app collections ([UTILS](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/UTILS.md)) → translate Admin UI ([TRANSLATIONS](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/TRANSLATIONS.md)).
20
20
 
21
21
  Demo: `dev/rbac.ts`, `dev/collections/posts.ts`.
22
22
 
@@ -24,13 +24,13 @@ Demo: `dev/rbac.ts`, `dev/collections/posts.ts`.
24
24
 
25
25
  ## Key features
26
26
 
27
- - **Five RBAC collections** — features, actions, permissions, roles, join table ([details](./docs/COLLECTIONS.md))
27
+ - **Five RBAC collections** — features, actions, permissions, roles, join table ([details](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/COLLECTIONS.md))
28
28
  - **Multi-role users** — union of enabled grants across assigned roles
29
- - **Granular permissions** — any `featureCode` + `actionCode` pair ([helpers](./docs/UTILS.md))
30
- - **Data scope** — per-role `own` / `hierarchy` / `all` for row-level filtering (`[dataScope` vs `isSuperAdmin](./docs/COLLECTIONS.md#what-is-datascope)`)
29
+ - **Granular permissions** — any `featureCode` + `actionCode` pair ([helpers](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/UTILS.md))
30
+ - **Data scope** — per-role `own` / `hierarchy` / `all` for row-level filtering (`[dataScope` vs `isSuperAdmin](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/COLLECTIONS.md#what-is-datascope)`)
31
31
  - **Permission matrix** — role edit UI; syncs to `roles-permissions` on save
32
32
  - **TypeScript** — typed plugin options and exports (`/types`)
33
- - **i18n** — plugin-owned translations merged into Payload i18n ([guide](./docs/TRANSLATIONS.md))
33
+ - **i18n** — plugin-owned translations merged into Payload i18n ([guide](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/TRANSLATIONS.md))
34
34
 
35
35
  ---
36
36
 
@@ -66,17 +66,15 @@ export default buildConfig({
66
66
  1. **permission-features** — e.g. `posts`, `users` (`code` = `featureCode` in access helpers)
67
67
  2. **permission-actions** — e.g. `create`, `read`, `update`, `delete`
68
68
  3. **permissions** — one row per feature + action pair
69
- 4. **roles** — set `[dataScope](./docs/COLLECTIONS.md#what-is-datascope)`; configure matrix on update screen → Save
70
- 5. **users** — assign roles; bootstrap `[isSuperAdmin](./docs/COLLECTIONS.md#bootstrap-super-admin)` via seed/API
69
+ 4. **roles** — set `[dataScope](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/COLLECTIONS.md#what-is-datascope)`; configure matrix on update screen → Save
70
+ 5. **users** — assign roles; bootstrap `[isSuperAdmin](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/COLLECTIONS.md#bootstrap-super-admin)` via seed/API
71
71
 
72
- → Full collection reference: **[COLLECTIONS](./docs/COLLECTIONS.md)**
72
+ → Full collection reference: **[COLLECTIONS](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/COLLECTIONS.md)**
73
73
 
74
74
  ### 3. Protect app collections
75
75
 
76
76
  ```ts
77
- import {
78
- getPermissionAccess,
79
- } from "@zealamic/payload-auth-rbac-plugin";
77
+ import { getPermissionAccess } from "@zealamic/payload-auth-rbac-plugin";
80
78
 
81
79
  export const Posts: CollectionConfig = {
82
80
  slug: "posts",
@@ -121,18 +119,18 @@ export const Posts: CollectionConfig = {
121
119
 
122
120
  **Access order:** anonymous → deny · super admin → allow · else → matrix permission (+ data scope when using scope helpers).
123
121
 
124
- → All helpers with examples: **[UTILS](./docs/UTILS.md)**
122
+ → All helpers with examples: **[UTILS](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/UTILS.md)**
125
123
 
126
124
  ---
127
125
 
128
126
  ## Plugin options
129
127
 
130
- | Option | Default | Description |
131
- | --------------------------- | ------- | ------------------------------------------------------------------------------------------- |
132
- | `disabled` | `false` | Skip runtime wiring; schema still registers |
133
- | `autoModifyUsersCollection` | `true` | Add RBAC fields + access on users collection |
134
- | `translations` | — | Admin / matrix i18n → **[TRANSLATIONS](./docs/TRANSLATIONS.md)** |
135
- | `collections` | — | Per-collection overrides → **[COLLECTIONS](./docs/COLLECTIONS.md#customizing-collections)** |
128
+ | Option | Default | Description |
129
+ | --------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
130
+ | `disabled` | `false` | Skip runtime wiring; schema still registers |
131
+ | `autoModifyUsersCollection` | `true` | Add RBAC fields + access on users collection |
132
+ | `translations` | — | Admin / matrix i18n → **[TRANSLATIONS](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/TRANSLATIONS.md)** |
133
+ | `collections` | — | Per-collection overrides → **[COLLECTIONS](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/COLLECTIONS.md#customizing-collections)** |
136
134
 
137
135
  Types: `@zealamic/payload-auth-rbac-plugin/types`
138
136
 
@@ -140,14 +138,14 @@ Types: `@zealamic/payload-auth-rbac-plugin/types`
140
138
 
141
139
  ## Exported helpers (summary)
142
140
 
143
- Full reference: **[UTILS](./docs/UTILS.md)**
141
+ Full reference: **[UTILS](https://github.com/zealamic/payload-auth-rbac-plugin/blob/main/docs/UTILS.md)**
144
142
 
145
- | Function | Purpose |
146
- | ----------------------------------------------------- | ----------------------------------------------- |
143
+ | Function | Purpose |
144
+ | ----------------------------------------------------- | ------------------------------------------------------ |
147
145
  | `getPermissionAccess` | Unified helper: permission / read scope / modify scope |
148
- | `getSuperAdminAccess` | Super admin only (RBAC collections default) |
149
- | `canAccessDocumentByDataScope` | Single-document scope check |
150
- | `resolveEffectiveDataScope` / `getDataScopeReadWhere` | Scope resolution & query filters |
146
+ | `getSuperAdminAccess` | Super admin only (RBAC collections default) |
147
+ | `canAccessDocumentByDataScope` | Single-document scope check |
148
+ | `resolveEffectiveDataScope` / `getDataScopeReadWhere` | Scope resolution & query filters |
151
149
 
152
150
  Constants: `CONSTANTS.ROLE.DATA_SCOPE`, etc.
153
151
 
@@ -171,5 +169,3 @@ MIT
171
169
  ---
172
170
 
173
171
  > _If this plugin helps your team ship safer access control with less friction, thank you for giving it a place in your stack._
174
-
175
-
Binary file
@@ -0,0 +1,2 @@
1
+ import type { PermissionActionsCollectionTranslations } from "./types.js";
2
+ export declare const permissionActionsDefaultTranslations: PermissionActionsCollectionTranslations;
@@ -0,0 +1,3 @@
1
+ import type { CollectionConfig } from "payload";
2
+ import type { PermissionActionsCollectionParams } from "./types.js";
3
+ export declare const getPermissionActionsCollection: (params: PermissionActionsCollectionParams) => CollectionConfig;
@@ -0,0 +1,51 @@
1
+ import type { CollectionConfig, Field } from "payload";
2
+ import { STATUS, TYPE } from "../../lib/constants/permission-action.js";
3
+ export type PermissionActionsCollectionTranslations = {
4
+ [locale: string]: {
5
+ labels?: {
6
+ singular?: string;
7
+ plural?: string;
8
+ };
9
+ admin?: {
10
+ group?: string;
11
+ };
12
+ fields?: {
13
+ code?: {
14
+ label?: string;
15
+ placeholder?: string;
16
+ };
17
+ type?: {
18
+ label?: string;
19
+ placeholder?: string;
20
+ mainLabel?: string;
21
+ subLabel?: string;
22
+ };
23
+ sortOrder?: {
24
+ label?: string;
25
+ placeholder?: string;
26
+ };
27
+ status?: {
28
+ label?: string;
29
+ placeholder?: string;
30
+ activeLabel?: string;
31
+ inactiveLabel?: string;
32
+ };
33
+ };
34
+ };
35
+ };
36
+ export type PermissionActionsCollectionParams = {
37
+ translations?: PermissionActionsCollectionTranslations;
38
+ fields?: Field[];
39
+ access?: CollectionConfig["access"];
40
+ labels?: CollectionConfig["labels"];
41
+ admin?: CollectionConfig["admin"];
42
+ };
43
+ export type PermissionActionStatus = (typeof STATUS)[keyof typeof STATUS];
44
+ export type PermissionActionType = (typeof TYPE)[keyof typeof TYPE];
45
+ export type PermissionAction = {
46
+ id: string | number;
47
+ code?: string | null;
48
+ sortOrder?: number | null;
49
+ type?: PermissionActionType | null;
50
+ status?: PermissionActionStatus | null;
51
+ };
@@ -0,0 +1,2 @@
1
+ import type { PermissionFeaturesCollectionTranslations } from "./types.js";
2
+ export declare const permissionFeaturesDefaultTranslations: PermissionFeaturesCollectionTranslations;
@@ -0,0 +1,3 @@
1
+ import type { CollectionConfig } from "payload";
2
+ import type { PermissionFeaturesCollectionParams } from "./types.js";
3
+ export declare const getPermissionFeaturesCollection: (params: PermissionFeaturesCollectionParams) => CollectionConfig;
@@ -0,0 +1,43 @@
1
+ import type { CollectionConfig, Field } from "payload";
2
+ import { STATUS } from "../../lib/constants/permission-feature.js";
3
+ export type PermissionFeaturesCollectionTranslations = {
4
+ [locale: string]: {
5
+ labels?: {
6
+ singular?: string;
7
+ plural?: string;
8
+ };
9
+ admin?: {
10
+ group?: string;
11
+ };
12
+ fields?: {
13
+ code?: {
14
+ label?: string;
15
+ placeholder?: string;
16
+ };
17
+ sortOrder?: {
18
+ label?: string;
19
+ placeholder?: string;
20
+ };
21
+ status?: {
22
+ label?: string;
23
+ placeholder?: string;
24
+ activeLabel?: string;
25
+ inactiveLabel?: string;
26
+ };
27
+ };
28
+ };
29
+ };
30
+ export type PermissionFeaturesCollectionParams = {
31
+ translations?: PermissionFeaturesCollectionTranslations;
32
+ fields?: Field[];
33
+ access?: CollectionConfig["access"];
34
+ labels?: CollectionConfig["labels"];
35
+ admin?: CollectionConfig["admin"];
36
+ };
37
+ export type PermissionFeatureStatus = (typeof STATUS)[keyof typeof STATUS];
38
+ export type PermissionFeature = {
39
+ id: string | number;
40
+ code?: string | null;
41
+ sortOrder?: number | null;
42
+ status?: PermissionFeatureStatus | null;
43
+ };
@@ -0,0 +1,2 @@
1
+ import type { PermissionsCollectionTranslations } from "./types.js";
2
+ export declare const permissionsDefaultTranslations: PermissionsCollectionTranslations;
@@ -0,0 +1,3 @@
1
+ import type { CollectionConfig } from "payload";
2
+ import type { PermissionsCollectionParams } from "./types.js";
3
+ export declare const getPermissionsCollection: (params: PermissionsCollectionParams) => CollectionConfig;
@@ -0,0 +1,54 @@
1
+ import type { CollectionConfig, Field } from "payload";
2
+ import { STATUS } from "src/lib/constants/permission.js";
3
+ export type PermissionsCollectionTranslations = {
4
+ [locale: string]: {
5
+ labels?: {
6
+ singular?: string;
7
+ plural?: string;
8
+ };
9
+ admin?: {
10
+ group?: string;
11
+ };
12
+ fields?: {
13
+ name?: {
14
+ label?: string;
15
+ placeholder?: string;
16
+ };
17
+ permissionFeature?: {
18
+ label?: string;
19
+ placeholder?: string;
20
+ };
21
+ permissionAction?: {
22
+ label?: string;
23
+ placeholder?: string;
24
+ };
25
+ sortOrder?: {
26
+ label?: string;
27
+ placeholder?: string;
28
+ };
29
+ status?: {
30
+ label?: string;
31
+ placeholder?: string;
32
+ activeLabel?: string;
33
+ inactiveLabel?: string;
34
+ };
35
+ };
36
+ };
37
+ };
38
+ export type PermissionsCollectionParams = {
39
+ translations?: PermissionsCollectionTranslations;
40
+ fields?: Field[];
41
+ access?: CollectionConfig["access"];
42
+ labels?: CollectionConfig["labels"];
43
+ admin?: CollectionConfig["admin"];
44
+ };
45
+ export type PermissionItemRef = string | number | {
46
+ id?: string | number;
47
+ };
48
+ export type PermissionStatus = (typeof STATUS)[keyof typeof STATUS];
49
+ export type Permission = {
50
+ id: string | number;
51
+ permissionFeature?: PermissionItemRef;
52
+ permissionAction?: PermissionItemRef;
53
+ status?: PermissionStatus | null;
54
+ };
@@ -0,0 +1,2 @@
1
+ import type { RolesCollectionTranslations } from "./types.js";
2
+ export declare const rolesDefaultTranslations: RolesCollectionTranslations;
@@ -0,0 +1,6 @@
1
+ import type { CollectionAfterChangeHook } from "payload";
2
+ /**
3
+ * Persists `permissionMatrixDraft` on the role document into `roles-permissions` rows.
4
+ * RBAC checks use `roles-permissions`, not the JSON draft field.
5
+ */
6
+ export declare const syncPermissionMatrixDraftAfterChange: CollectionAfterChangeHook;
@@ -0,0 +1,3 @@
1
+ import type { CollectionConfig } from "payload";
2
+ import type { RolesCollectionParams } from "./types.js";
3
+ export declare const getRolesCollection: (params: RolesCollectionParams) => CollectionConfig;
@@ -0,0 +1,53 @@
1
+ import type { CollectionConfig, Field } from "payload";
2
+ import type { DATA_SCOPE, STATUS } from "../../lib/constants/role.js";
3
+ export type DataScope = (typeof DATA_SCOPE)[keyof typeof DATA_SCOPE];
4
+ export type RoleStatus = (typeof STATUS)[keyof typeof STATUS];
5
+ export type RolesCollectionTranslations = {
6
+ [locale: string]: {
7
+ labels?: {
8
+ singular?: string;
9
+ plural?: string;
10
+ };
11
+ admin?: {
12
+ group?: string;
13
+ };
14
+ fields?: {
15
+ code?: {
16
+ label?: string;
17
+ placeholder?: string;
18
+ };
19
+ name?: {
20
+ label?: string;
21
+ placeholder?: string;
22
+ };
23
+ description?: {
24
+ label?: string;
25
+ placeholder?: string;
26
+ };
27
+ status?: {
28
+ label?: string;
29
+ placeholder?: string;
30
+ activeLabel?: string;
31
+ inactiveLabel?: string;
32
+ };
33
+ dataScope?: {
34
+ label?: string;
35
+ placeholder?: string;
36
+ allLabel?: string;
37
+ ownLabel?: string;
38
+ hierarchyLabel?: string;
39
+ };
40
+ permissionMatrix?: {
41
+ label?: string;
42
+ placeholder?: string;
43
+ };
44
+ };
45
+ };
46
+ };
47
+ export type RolesCollectionParams = {
48
+ translations?: RolesCollectionTranslations;
49
+ fields?: Field[];
50
+ access?: CollectionConfig["access"];
51
+ labels?: CollectionConfig["labels"];
52
+ admin?: CollectionConfig["admin"];
53
+ };
@@ -0,0 +1,2 @@
1
+ import type { RolesPermissionsCollectionTranslations } from "./types.js";
2
+ export declare const rolesPermissionsDefaultTranslations: RolesPermissionsCollectionTranslations;
@@ -0,0 +1,3 @@
1
+ import type { CollectionConfig } from "payload";
2
+ import type { RolesPermissionsCollectionParams } from "./types.js";
3
+ export declare const getRolesPermissionsCollection: (params: RolesPermissionsCollectionParams) => CollectionConfig;
@@ -0,0 +1,39 @@
1
+ import type { CollectionConfig, Field } from "payload";
2
+ export type RolesPermissionsCollectionTranslations = {
3
+ [locale: string]: {
4
+ labels?: {
5
+ singular?: string;
6
+ plural?: string;
7
+ };
8
+ admin?: {
9
+ group?: string;
10
+ };
11
+ fields?: {
12
+ role?: {
13
+ label?: string;
14
+ placeholder?: string;
15
+ };
16
+ permission?: {
17
+ label?: string;
18
+ placeholder?: string;
19
+ };
20
+ enabled?: {
21
+ label?: string;
22
+ placeholder?: string;
23
+ };
24
+ };
25
+ };
26
+ };
27
+ export type RolesPermissionsCollectionParams = {
28
+ translations?: RolesPermissionsCollectionTranslations;
29
+ fields?: Field[];
30
+ access?: CollectionConfig["access"];
31
+ labels?: CollectionConfig["labels"];
32
+ admin?: CollectionConfig["admin"];
33
+ };
34
+ export type RolePermission = {
35
+ id: string | number;
36
+ role?: string | number;
37
+ permission?: string | number;
38
+ enabled?: boolean;
39
+ };
@@ -0,0 +1,2 @@
1
+ import { UsersModificationTranslations } from "./types.js";
2
+ export declare const usersDefaultTranslations: UsersModificationTranslations;
@@ -0,0 +1,3 @@
1
+ import type { Config } from "payload";
2
+ import type { UsersModificationParams } from "./types.js";
3
+ export declare const modifyUsersCollection: (params?: UsersModificationParams) => (incomingConfig: Config) => Config;
@@ -0,0 +1,31 @@
1
+ import type { CollectionAfterChangeHook, CollectionAfterDeleteHook, CollectionBeforeChangeHook, PayloadRequest } from "payload";
2
+ type UserDoc = {
3
+ id?: string | number;
4
+ parent?: ItemRef;
5
+ parentPath?: string | null;
6
+ };
7
+ /** Ancestor IDs from root to parent (exclusive of self), e.g. `"1,2"`. */
8
+ export declare const buildParentPathFromParentDoc: (parent: UserDoc | null | undefined) => string;
9
+ export declare const computeParentPath: ({ parentId, req, userSlug, }: {
10
+ parentId?: string;
11
+ req: PayloadRequest;
12
+ userSlug: string;
13
+ }) => Promise<string>;
14
+ export declare const createUserParentPathHooks: (userSlug: string) => {
15
+ beforeChange: CollectionBeforeChangeHook;
16
+ afterChange: CollectionAfterChangeHook;
17
+ afterDelete: CollectionAfterDeleteHook;
18
+ };
19
+ export declare const mergeUserCollectionHooks: ({ existingHooks, userSlug, }: {
20
+ existingHooks?: {
21
+ beforeChange?: CollectionBeforeChangeHook[] | CollectionBeforeChangeHook;
22
+ afterChange?: CollectionAfterChangeHook[] | CollectionAfterChangeHook;
23
+ afterDelete?: CollectionAfterDeleteHook[] | CollectionAfterDeleteHook;
24
+ };
25
+ userSlug: string;
26
+ }) => {
27
+ beforeChange: CollectionBeforeChangeHook[];
28
+ afterChange: CollectionAfterChangeHook[];
29
+ afterDelete: CollectionAfterDeleteHook[];
30
+ };
31
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { Field } from "payload";
2
+ export type UsersModificationTranslations = {
3
+ [locale: string]: {
4
+ fields?: {
5
+ isSuperAdmin?: {
6
+ label?: string;
7
+ };
8
+ roles?: {
9
+ label?: string;
10
+ placeholder?: string;
11
+ };
12
+ parent?: {
13
+ label?: string;
14
+ placeholder?: string;
15
+ };
16
+ };
17
+ };
18
+ };
19
+ export type UsersModificationParams = {
20
+ translations?: UsersModificationTranslations;
21
+ fields?: Field[];
22
+ rolesSlug?: string;
23
+ };
@@ -0,0 +1,2 @@
1
+ import type { RolePermissionMatrixClientTranslations } from "./types.js";
2
+ export declare const rolePermissionMatrixClientDefaultTranslations: RolePermissionMatrixClientTranslations;
@@ -8,7 +8,8 @@ export const rolePermissionMatrixClientDefaultTranslations = {
8
8
  },
9
9
  title: "Permission Matrix",
10
10
  features: {
11
- label: "Features"
11
+ label: "Features",
12
+ users: "Users"
12
13
  },
13
14
  actions: {
14
15
  label: "Actions",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/role-permission-matrix-client/default-data.ts"],"sourcesContent":["import type { RolePermissionMatrixClientTranslations } from \"./types.js\"\n\nexport const rolePermissionMatrixClientDefaultTranslations: RolePermissionMatrixClientTranslations =\n {\n en: {\n viewInUpdateScreenOnly: {\n label: \"View permission matrix in update screen only\",\n },\n loading: {\n placeholder: \"Loading permission matrix...\",\n },\n title: \"Permission Matrix\",\n features: {\n label: \"Features\",\n },\n actions: {\n label: \"Actions\",\n create: \"Create\",\n read: \"Read\",\n update: \"Update\",\n delete: \"Delete\",\n },\n },\n }\n"],"names":["rolePermissionMatrixClientDefaultTranslations","en","viewInUpdateScreenOnly","label","loading","placeholder","title","features","actions","create","read","update","delete"],"mappings":"AAEA,OAAO,MAAMA,gDACX;IACEC,IAAI;QACFC,wBAAwB;YACtBC,OAAO;QACT;QACAC,SAAS;YACPC,aAAa;QACf;QACAC,OAAO;QACPC,UAAU;YACRJ,OAAO;QACT;QACAK,SAAS;YACPL,OAAO;YACPM,QAAQ;YACRC,MAAM;YACNC,QAAQ;YACRC,QAAQ;QACV;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/components/role-permission-matrix-client/default-data.ts"],"sourcesContent":["import type { RolePermissionMatrixClientTranslations } from \"./types.js\";\n\nexport const rolePermissionMatrixClientDefaultTranslations: RolePermissionMatrixClientTranslations =\n {\n en: {\n viewInUpdateScreenOnly: {\n label: \"View permission matrix in update screen only\",\n },\n loading: {\n placeholder: \"Loading permission matrix...\",\n },\n title: \"Permission Matrix\",\n features: {\n label: \"Features\",\n users: \"Users\",\n },\n actions: {\n label: \"Actions\",\n create: \"Create\",\n read: \"Read\",\n update: \"Update\",\n delete: \"Delete\",\n },\n },\n };\n"],"names":["rolePermissionMatrixClientDefaultTranslations","en","viewInUpdateScreenOnly","label","loading","placeholder","title","features","users","actions","create","read","update","delete"],"mappings":"AAEA,OAAO,MAAMA,gDACX;IACEC,IAAI;QACFC,wBAAwB;YACtBC,OAAO;QACT;QACAC,SAAS;YACPC,aAAa;QACf;QACAC,OAAO;QACPC,UAAU;YACRJ,OAAO;YACPK,OAAO;QACT;QACAC,SAAS;YACPN,OAAO;YACPO,QAAQ;YACRC,MAAM;YACNC,QAAQ;YACRC,QAAQ;QACV;IACF;AACF,EAAE"}
@@ -0,0 +1 @@
1
+ export declare const RolePermissionMatrixClient: () => import("react/jsx-runtime").JSX.Element;