@zealamic/payload-auth-rbac-plugin 1.0.0-beta.1
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/LICENSE +21 -0
- package/README.md +175 -0
- package/dist/collections/permission-actions/default-data.js +35 -0
- package/dist/collections/permission-actions/default-data.js.map +1 -0
- package/dist/collections/permission-actions/index.js +96 -0
- package/dist/collections/permission-actions/index.js.map +1 -0
- package/dist/collections/permission-actions/types.js +3 -0
- package/dist/collections/permission-actions/types.js.map +1 -0
- package/dist/collections/permission-features/default-data.js +29 -0
- package/dist/collections/permission-features/default-data.js.map +1 -0
- package/dist/collections/permission-features/index.js +82 -0
- package/dist/collections/permission-features/index.js.map +1 -0
- package/dist/collections/permission-features/types.js +3 -0
- package/dist/collections/permission-features/types.js.map +1 -0
- package/dist/collections/permissions/default-data.js +37 -0
- package/dist/collections/permissions/default-data.js.map +1 -0
- package/dist/collections/permissions/index.js +102 -0
- package/dist/collections/permissions/index.js.map +1 -0
- package/dist/collections/permissions/types.js +3 -0
- package/dist/collections/permissions/types.js.map +1 -0
- package/dist/collections/roles/default-data.js +44 -0
- package/dist/collections/roles/default-data.js.map +1 -0
- package/dist/collections/roles/hooks/sync-permission-matrix-draft.js +66 -0
- package/dist/collections/roles/hooks/sync-permission-matrix-draft.js.map +1 -0
- package/dist/collections/roles/index.js +122 -0
- package/dist/collections/roles/index.js.map +1 -0
- package/dist/collections/roles/types.js +3 -0
- package/dist/collections/roles/types.js.map +1 -0
- package/dist/collections/roles-permissions/default-data.js +27 -0
- package/dist/collections/roles-permissions/default-data.js.map +1 -0
- package/dist/collections/roles-permissions/index.js +75 -0
- package/dist/collections/roles-permissions/index.js.map +1 -0
- package/dist/collections/roles-permissions/types.js +3 -0
- package/dist/collections/roles-permissions/types.js.map +1 -0
- package/dist/collections/users/default-data.js +19 -0
- package/dist/collections/users/default-data.js.map +1 -0
- package/dist/collections/users/index.js +135 -0
- package/dist/collections/users/index.js.map +1 -0
- package/dist/collections/users/parent-path.js +210 -0
- package/dist/collections/users/parent-path.js.map +1 -0
- package/dist/collections/users/types.js +3 -0
- package/dist/collections/users/types.js.map +1 -0
- package/dist/components/role-permission-matrix-client/default-data.js +23 -0
- package/dist/components/role-permission-matrix-client/default-data.js.map +1 -0
- package/dist/components/role-permission-matrix-client/index.js +299 -0
- package/dist/components/role-permission-matrix-client/index.js.map +1 -0
- package/dist/components/role-permission-matrix-client/types.js +3 -0
- package/dist/components/role-permission-matrix-client/types.js.map +1 -0
- package/dist/endpoints/customEndpointHandler.js +7 -0
- package/dist/endpoints/customEndpointHandler.js.map +1 -0
- package/dist/exports/client.js +3 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/rsc.js +2 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/general-types.d.js +2 -0
- package/dist/general-types.d.js.map +1 -0
- package/dist/index.js +184 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/constants/general.js +3 -0
- package/dist/lib/constants/general.js.map +1 -0
- package/dist/lib/constants/index.js +16 -0
- package/dist/lib/constants/index.js.map +1 -0
- package/dist/lib/constants/permission-action.js +10 -0
- package/dist/lib/constants/permission-action.js.map +1 -0
- package/dist/lib/constants/permission-feature.js +6 -0
- package/dist/lib/constants/permission-feature.js.map +1 -0
- package/dist/lib/constants/permission.js +6 -0
- package/dist/lib/constants/permission.js.map +1 -0
- package/dist/lib/constants/role.js +11 -0
- package/dist/lib/constants/role.js.map +1 -0
- package/dist/lib/constants/user.js +3 -0
- package/dist/lib/constants/user.js.map +1 -0
- package/dist/lib/utils/access.js +452 -0
- package/dist/lib/utils/access.js.map +1 -0
- package/dist/lib/utils/data.js +7 -0
- package/dist/lib/utils/data.js.map +1 -0
- package/dist/lib/utils/fields.js +41 -0
- package/dist/lib/utils/fields.js.map +1 -0
- package/dist/lib/utils/index.js +6 -0
- package/dist/lib/utils/index.js.map +1 -0
- package/dist/lib/utils/localization.js +52 -0
- package/dist/lib/utils/localization.js.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/package.json +122 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { getArrayOfMergedFieldAffectingData, getPermissionAccess, toLocaleRecord } from "../../lib/utils/index.js";
|
|
2
|
+
import { mergeUserCollectionHooks } from "./parent-path.js";
|
|
3
|
+
const buildDefaultFields = (translations)=>{
|
|
4
|
+
const locales = Object.keys(translations);
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
name: "isSuperAdmin",
|
|
8
|
+
type: "checkbox",
|
|
9
|
+
defaultValue: false,
|
|
10
|
+
label: toLocaleRecord(locales, (locale)=>translations[locale]?.fields?.isSuperAdmin?.label),
|
|
11
|
+
admin: {
|
|
12
|
+
readOnly: true
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "roles",
|
|
17
|
+
type: "relationship",
|
|
18
|
+
relationTo: "roles",
|
|
19
|
+
hasMany: true,
|
|
20
|
+
label: toLocaleRecord(locales, (locale)=>translations[locale]?.fields?.roles?.label)
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "parent",
|
|
24
|
+
type: "relationship",
|
|
25
|
+
relationTo: "users",
|
|
26
|
+
label: toLocaleRecord(locales, (locale)=>translations[locale]?.fields?.parent?.label),
|
|
27
|
+
filterOptions: ({ id })=>id ? {
|
|
28
|
+
id: {
|
|
29
|
+
not_equals: id
|
|
30
|
+
}
|
|
31
|
+
} : true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "parentPath",
|
|
35
|
+
type: "text",
|
|
36
|
+
index: true,
|
|
37
|
+
admin: {
|
|
38
|
+
hidden: true,
|
|
39
|
+
readOnly: true
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
};
|
|
44
|
+
export const modifyUsersCollection = (params = {})=>{
|
|
45
|
+
const { translations = {}, fields: customFields = [] } = params;
|
|
46
|
+
return (incomingConfig)=>{
|
|
47
|
+
const config = {
|
|
48
|
+
...incomingConfig
|
|
49
|
+
};
|
|
50
|
+
const userSlug = config.admin?.user || "users";
|
|
51
|
+
const customAdmin = {
|
|
52
|
+
defaultColumns: [
|
|
53
|
+
"email",
|
|
54
|
+
"roles",
|
|
55
|
+
"isSuperAdmin",
|
|
56
|
+
"updatedAt"
|
|
57
|
+
],
|
|
58
|
+
useAsTitle: "email",
|
|
59
|
+
...config.admin
|
|
60
|
+
};
|
|
61
|
+
const pluginFields = getArrayOfMergedFieldAffectingData({
|
|
62
|
+
defaultFields: buildDefaultFields(translations),
|
|
63
|
+
fields: customFields
|
|
64
|
+
});
|
|
65
|
+
const existing = (config.collections || []).find((c)=>c.slug === userSlug);
|
|
66
|
+
const dataScopeOptions = {
|
|
67
|
+
createdByField: "id",
|
|
68
|
+
usersCollectionSlug: userSlug
|
|
69
|
+
};
|
|
70
|
+
const defaultAccess = {
|
|
71
|
+
create: getPermissionAccess({
|
|
72
|
+
featureCode: userSlug,
|
|
73
|
+
actionCode: "create"
|
|
74
|
+
}),
|
|
75
|
+
update: getPermissionAccess({
|
|
76
|
+
featureCode: userSlug,
|
|
77
|
+
actionCode: "update",
|
|
78
|
+
mode: "modify",
|
|
79
|
+
collectionSlug: userSlug,
|
|
80
|
+
options: dataScopeOptions
|
|
81
|
+
}),
|
|
82
|
+
delete: getPermissionAccess({
|
|
83
|
+
featureCode: userSlug,
|
|
84
|
+
actionCode: "delete",
|
|
85
|
+
mode: "modify",
|
|
86
|
+
collectionSlug: userSlug,
|
|
87
|
+
options: dataScopeOptions
|
|
88
|
+
}),
|
|
89
|
+
read: getPermissionAccess({
|
|
90
|
+
featureCode: userSlug,
|
|
91
|
+
actionCode: "read",
|
|
92
|
+
options: dataScopeOptions
|
|
93
|
+
})
|
|
94
|
+
};
|
|
95
|
+
if (existing) {
|
|
96
|
+
config.collections = (config.collections || []).map((collection)=>{
|
|
97
|
+
if (collection.slug !== userSlug) {
|
|
98
|
+
return collection;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
...collection,
|
|
102
|
+
fields: [
|
|
103
|
+
...collection.fields,
|
|
104
|
+
...pluginFields
|
|
105
|
+
],
|
|
106
|
+
access: {
|
|
107
|
+
...defaultAccess,
|
|
108
|
+
...collection.access
|
|
109
|
+
},
|
|
110
|
+
hooks: mergeUserCollectionHooks({
|
|
111
|
+
existingHooks: collection.hooks,
|
|
112
|
+
userSlug
|
|
113
|
+
})
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
config.collections = [
|
|
118
|
+
...config.collections || [],
|
|
119
|
+
{
|
|
120
|
+
slug: userSlug,
|
|
121
|
+
auth: true,
|
|
122
|
+
admin: customAdmin,
|
|
123
|
+
fields: pluginFields,
|
|
124
|
+
access: defaultAccess,
|
|
125
|
+
hooks: mergeUserCollectionHooks({
|
|
126
|
+
userSlug
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
return config;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/users/index.ts"],"sourcesContent":["import type { Config, Field, PayloadRequest } from \"payload\";\nimport {\n getArrayOfMergedFieldAffectingData,\n getPermissionAccess,\n toLocaleRecord,\n} from \"../../lib/utils/index.js\";\nimport { mergeUserCollectionHooks } from \"./parent-path.js\";\nimport type {\n UsersModificationParams,\n UsersModificationTranslations,\n} from \"./types.js\";\n\nconst buildDefaultFields = (\n translations: UsersModificationTranslations,\n): Field[] => {\n const locales = Object.keys(translations);\n return [\n {\n name: \"isSuperAdmin\",\n type: \"checkbox\",\n defaultValue: false,\n label: toLocaleRecord(\n locales,\n (locale) => translations[locale]?.fields?.isSuperAdmin?.label,\n ),\n admin: {\n readOnly: true,\n },\n },\n {\n name: \"roles\",\n type: \"relationship\",\n relationTo: \"roles\",\n hasMany: true,\n label: toLocaleRecord(\n locales,\n (locale) => translations[locale]?.fields?.roles?.label,\n ),\n },\n {\n name: \"parent\",\n type: \"relationship\",\n relationTo: \"users\",\n label: toLocaleRecord(\n locales,\n (locale) => translations[locale]?.fields?.parent?.label,\n ),\n filterOptions: ({ id }) => (id ? { id: { not_equals: id } } : true),\n },\n {\n name: \"parentPath\",\n type: \"text\",\n index: true,\n admin: {\n hidden: true,\n readOnly: true,\n },\n },\n ];\n};\n\nexport const modifyUsersCollection = (params: UsersModificationParams = {}) => {\n const { translations = {}, fields: customFields = [] } = params;\n\n return (incomingConfig: Config): Config => {\n const config = { ...incomingConfig };\n const userSlug = config.admin?.user || \"users\";\n\n const customAdmin = {\n defaultColumns: [\"email\", \"roles\", \"isSuperAdmin\", \"updatedAt\"],\n useAsTitle: \"email\",\n ...config.admin,\n };\n\n const pluginFields = getArrayOfMergedFieldAffectingData({\n defaultFields: buildDefaultFields(translations),\n fields: customFields,\n });\n\n const existing = (config.collections || []).find(\n (c) => c.slug === userSlug,\n );\n const dataScopeOptions = {\n createdByField: \"id\",\n usersCollectionSlug: userSlug,\n } as const;\n\n const defaultAccess = {\n create: getPermissionAccess({\n featureCode: userSlug,\n actionCode: \"create\",\n }),\n update: getPermissionAccess({\n featureCode: userSlug,\n actionCode: \"update\",\n mode: \"modify\",\n collectionSlug: userSlug,\n options: dataScopeOptions,\n }),\n delete: getPermissionAccess({\n featureCode: userSlug,\n actionCode: \"delete\",\n mode: \"modify\",\n collectionSlug: userSlug,\n options: dataScopeOptions,\n }),\n read: getPermissionAccess({\n featureCode: userSlug,\n actionCode: \"read\",\n options: dataScopeOptions,\n }),\n };\n\n if (existing) {\n config.collections = (config.collections || []).map((collection) => {\n if (collection.slug !== userSlug) {\n return collection;\n }\n return {\n ...collection,\n fields: [...collection.fields, ...pluginFields],\n access: {\n ...defaultAccess,\n ...collection.access,\n },\n hooks: mergeUserCollectionHooks({\n existingHooks: collection.hooks,\n userSlug,\n }),\n };\n });\n } else {\n config.collections = [\n ...(config.collections || []),\n {\n slug: userSlug,\n auth: true,\n admin: customAdmin,\n fields: pluginFields,\n access: defaultAccess,\n hooks: mergeUserCollectionHooks({ userSlug }),\n },\n ];\n }\n\n return config;\n };\n};\n"],"names":["getArrayOfMergedFieldAffectingData","getPermissionAccess","toLocaleRecord","mergeUserCollectionHooks","buildDefaultFields","translations","locales","Object","keys","name","type","defaultValue","label","locale","fields","isSuperAdmin","admin","readOnly","relationTo","hasMany","roles","parent","filterOptions","id","not_equals","index","hidden","modifyUsersCollection","params","customFields","incomingConfig","config","userSlug","user","customAdmin","defaultColumns","useAsTitle","pluginFields","defaultFields","existing","collections","find","c","slug","dataScopeOptions","createdByField","usersCollectionSlug","defaultAccess","create","featureCode","actionCode","update","mode","collectionSlug","options","delete","read","map","collection","access","hooks","existingHooks","auth"],"mappings":"AACA,SACEA,kCAAkC,EAClCC,mBAAmB,EACnBC,cAAc,QACT,2BAA2B;AAClC,SAASC,wBAAwB,QAAQ,mBAAmB;AAM5D,MAAMC,qBAAqB,CACzBC;IAEA,MAAMC,UAAUC,OAAOC,IAAI,CAACH;IAC5B,OAAO;QACL;YACEI,MAAM;YACNC,MAAM;YACNC,cAAc;YACdC,OAAOV,eACLI,SACA,CAACO,SAAWR,YAAY,CAACQ,OAAO,EAAEC,QAAQC,cAAcH;YAE1DI,OAAO;gBACLC,UAAU;YACZ;QACF;QACA;YACER,MAAM;YACNC,MAAM;YACNQ,YAAY;YACZC,SAAS;YACTP,OAAOV,eACLI,SACA,CAACO,SAAWR,YAAY,CAACQ,OAAO,EAAEC,QAAQM,OAAOR;QAErD;QACA;YACEH,MAAM;YACNC,MAAM;YACNQ,YAAY;YACZN,OAAOV,eACLI,SACA,CAACO,SAAWR,YAAY,CAACQ,OAAO,EAAEC,QAAQO,QAAQT;YAEpDU,eAAe,CAAC,EAAEC,EAAE,EAAE,GAAMA,KAAK;oBAAEA,IAAI;wBAAEC,YAAYD;oBAAG;gBAAE,IAAI;QAChE;Q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KAAKX,UAAU;oBAChC,OAAO0B;gBACT;gBACA,OAAO;oBACL,GAAGA,UAAU;oBACb5C,QAAQ;2BAAI4C,WAAW5C,MAAM;2BAAKuB;qBAAa;oBAC/CsB,QAAQ;wBACN,GAAGZ,aAAa;wBAChB,GAAGW,WAAWC,MAAM;oBACtB;oBACAC,OAAOzD,yBAAyB;wBAC9B0D,eAAeH,WAAWE,KAAK;wBAC/B5B;oBACF;gBACF;YACF;QACF,OAAO;YACLD,OAAOS,WAAW,GAAG;mBACfT,OAAOS,WAAW,IAAI,EAAE;gBAC5B;oBACEG,MAAMX;oBACN8B,MAAM;oBACN9C,OAAOkB;oBACPpB,QAAQuB;oBACRsB,QAAQZ;oBACRa,OAAOzD,yBAAyB;wBAAE6B;oBAAS;gBAC7C;aACD;QACH;QAEA,OAAOD;IACT;AACF,EAAE"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { PARENT_PATH_SEPARATOR } from "../../lib/constants/user.js";
|
|
2
|
+
import { toID } from "../../lib/utils/data.js";
|
|
3
|
+
const getParentId = (parent)=>{
|
|
4
|
+
const id = toID(parent ?? undefined);
|
|
5
|
+
return id || undefined;
|
|
6
|
+
};
|
|
7
|
+
/** Ancestor IDs from root to parent (exclusive of self), e.g. `"1,2"`. */ export const buildParentPathFromParentDoc = (parent)=>{
|
|
8
|
+
if (!parent?.id) {
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
const parentId = String(parent.id);
|
|
12
|
+
const ancestorPath = parent.parentPath?.trim();
|
|
13
|
+
if (!ancestorPath) {
|
|
14
|
+
return parentId;
|
|
15
|
+
}
|
|
16
|
+
return `${ancestorPath}${PARENT_PATH_SEPARATOR}${parentId}`;
|
|
17
|
+
};
|
|
18
|
+
export const computeParentPath = async ({ parentId, req, userSlug })=>{
|
|
19
|
+
if (!parentId) {
|
|
20
|
+
return "";
|
|
21
|
+
}
|
|
22
|
+
const parentDoc = await req.payload.findByID({
|
|
23
|
+
collection: userSlug,
|
|
24
|
+
id: parentId,
|
|
25
|
+
depth: 0,
|
|
26
|
+
req
|
|
27
|
+
});
|
|
28
|
+
return buildParentPathFromParentDoc(parentDoc);
|
|
29
|
+
};
|
|
30
|
+
const pathContainsId = (parentPath, id)=>{
|
|
31
|
+
if (!parentPath) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return parentPath.split(PARENT_PATH_SEPARATOR).includes(id);
|
|
35
|
+
};
|
|
36
|
+
const validateParentAssignment = async ({ userId, parentId, req, userSlug })=>{
|
|
37
|
+
if (!parentId) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
if (userId && String(parentId) === String(userId)) {
|
|
41
|
+
return "A user cannot be their own parent.";
|
|
42
|
+
}
|
|
43
|
+
if (!userId) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
const parentDoc = await req.payload.findByID({
|
|
47
|
+
collection: userSlug,
|
|
48
|
+
id: parentId,
|
|
49
|
+
depth: 0,
|
|
50
|
+
req
|
|
51
|
+
});
|
|
52
|
+
const parentPath = parentDoc.parentPath ?? "";
|
|
53
|
+
if (pathContainsId(parentPath, String(userId))) {
|
|
54
|
+
return "Cannot assign a descendant as parent (would create a cycle).";
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
};
|
|
58
|
+
const syncDescendantParentPaths = async ({ userId, req, userSlug })=>{
|
|
59
|
+
const children = await req.payload.find({
|
|
60
|
+
collection: userSlug,
|
|
61
|
+
depth: 0,
|
|
62
|
+
limit: 0,
|
|
63
|
+
pagination: false,
|
|
64
|
+
req,
|
|
65
|
+
where: {
|
|
66
|
+
parent: {
|
|
67
|
+
equals: userId
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
for (const child of children.docs){
|
|
72
|
+
if (!child.id) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const parentId = getParentId(child.parent);
|
|
76
|
+
const nextParentPath = await computeParentPath({
|
|
77
|
+
parentId,
|
|
78
|
+
req,
|
|
79
|
+
userSlug
|
|
80
|
+
});
|
|
81
|
+
if ((child.parentPath ?? "") === nextParentPath) {
|
|
82
|
+
await syncDescendantParentPaths({
|
|
83
|
+
userId: child.id,
|
|
84
|
+
req,
|
|
85
|
+
userSlug
|
|
86
|
+
});
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
await req.payload.update({
|
|
90
|
+
collection: userSlug,
|
|
91
|
+
id: child.id,
|
|
92
|
+
data: {
|
|
93
|
+
parentPath: nextParentPath
|
|
94
|
+
},
|
|
95
|
+
depth: 0,
|
|
96
|
+
req,
|
|
97
|
+
overrideAccess: true
|
|
98
|
+
});
|
|
99
|
+
await syncDescendantParentPaths({
|
|
100
|
+
userId: child.id,
|
|
101
|
+
req,
|
|
102
|
+
userSlug
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
export const createUserParentPathHooks = (userSlug)=>{
|
|
107
|
+
const beforeChange = async ({ data, req, operation, originalDoc })=>{
|
|
108
|
+
const incoming = data;
|
|
109
|
+
const previous = originalDoc;
|
|
110
|
+
const parentRef = incoming.parent !== undefined ? incoming.parent : operation === "update" ? previous?.parent : undefined;
|
|
111
|
+
const parentId = getParentId(parentRef);
|
|
112
|
+
const validation = await validateParentAssignment({
|
|
113
|
+
userId: operation === "update" ? previous?.id ?? incoming.id : incoming.id,
|
|
114
|
+
parentId,
|
|
115
|
+
req,
|
|
116
|
+
userSlug
|
|
117
|
+
});
|
|
118
|
+
if (validation !== true) {
|
|
119
|
+
throw new Error(validation);
|
|
120
|
+
}
|
|
121
|
+
incoming.parentPath = await computeParentPath({
|
|
122
|
+
parentId,
|
|
123
|
+
req,
|
|
124
|
+
userSlug
|
|
125
|
+
});
|
|
126
|
+
return incoming;
|
|
127
|
+
};
|
|
128
|
+
const afterChange = async ({ doc, previousDoc, req, operation })=>{
|
|
129
|
+
const current = doc;
|
|
130
|
+
const previous = previousDoc;
|
|
131
|
+
if (!current.id) {
|
|
132
|
+
return doc;
|
|
133
|
+
}
|
|
134
|
+
const previousParentId = getParentId(previous?.parent);
|
|
135
|
+
const nextParentId = getParentId(current.parent);
|
|
136
|
+
const parentChanged = operation === "create" || previousParentId !== nextParentId;
|
|
137
|
+
if (parentChanged) {
|
|
138
|
+
await syncDescendantParentPaths({
|
|
139
|
+
userId: current.id,
|
|
140
|
+
req,
|
|
141
|
+
userSlug
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return doc;
|
|
145
|
+
};
|
|
146
|
+
const afterDelete = async ({ doc, req })=>{
|
|
147
|
+
const deleted = doc;
|
|
148
|
+
if (!deleted?.id) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const children = await req.payload.find({
|
|
152
|
+
collection: userSlug,
|
|
153
|
+
depth: 0,
|
|
154
|
+
limit: 0,
|
|
155
|
+
pagination: false,
|
|
156
|
+
req,
|
|
157
|
+
where: {
|
|
158
|
+
parent: {
|
|
159
|
+
equals: deleted.id
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
for (const child of children.docs){
|
|
164
|
+
if (!child.id) {
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
await req.payload.update({
|
|
168
|
+
collection: userSlug,
|
|
169
|
+
id: child.id,
|
|
170
|
+
data: {
|
|
171
|
+
parent: null,
|
|
172
|
+
parentPath: ""
|
|
173
|
+
},
|
|
174
|
+
depth: 0,
|
|
175
|
+
req,
|
|
176
|
+
overrideAccess: true
|
|
177
|
+
});
|
|
178
|
+
await syncDescendantParentPaths({
|
|
179
|
+
userId: child.id,
|
|
180
|
+
req,
|
|
181
|
+
userSlug
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
return {
|
|
186
|
+
beforeChange,
|
|
187
|
+
afterChange,
|
|
188
|
+
afterDelete
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
const mergeHookArrays = (existing, added)=>{
|
|
192
|
+
const base = Array.isArray(existing) ? existing : existing ? [
|
|
193
|
+
existing
|
|
194
|
+
] : [];
|
|
195
|
+
return [
|
|
196
|
+
...base,
|
|
197
|
+
added
|
|
198
|
+
];
|
|
199
|
+
};
|
|
200
|
+
export const mergeUserCollectionHooks = ({ existingHooks, userSlug })=>{
|
|
201
|
+
const { beforeChange, afterChange, afterDelete } = createUserParentPathHooks(userSlug);
|
|
202
|
+
return {
|
|
203
|
+
...existingHooks,
|
|
204
|
+
beforeChange: mergeHookArrays(existingHooks?.beforeChange, beforeChange),
|
|
205
|
+
afterChange: mergeHookArrays(existingHooks?.afterChange, afterChange),
|
|
206
|
+
afterDelete: mergeHookArrays(existingHooks?.afterDelete, afterDelete)
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
//# sourceMappingURL=parent-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/users/parent-path.ts"],"sourcesContent":["import type {\n CollectionAfterChangeHook,\n CollectionAfterDeleteHook,\n CollectionBeforeChangeHook,\n PayloadRequest,\n} from \"payload\";\nimport { PARENT_PATH_SEPARATOR } from \"../../lib/constants/user.js\";\nimport { toID } from \"../../lib/utils/data.js\";\n\ntype UserDoc = {\n id?: string | number;\n parent?: ItemRef;\n parentPath?: string | null;\n};\n\nconst getParentId = (parent: ItemRef | null | undefined): string | undefined => {\n const id = toID(parent ?? undefined);\n return id || undefined;\n};\n\n/** Ancestor IDs from root to parent (exclusive of self), e.g. `\"1,2\"`. */\nexport const buildParentPathFromParentDoc = (\n parent: UserDoc | null | undefined,\n): string => {\n if (!parent?.id) {\n return \"\";\n }\n\n const parentId = String(parent.id);\n const ancestorPath = parent.parentPath?.trim();\n\n if (!ancestorPath) {\n return parentId;\n }\n\n return `${ancestorPath}${PARENT_PATH_SEPARATOR}${parentId}`;\n};\n\nexport const computeParentPath = async ({\n parentId,\n req,\n userSlug,\n}: {\n parentId?: string;\n req: PayloadRequest;\n userSlug: string;\n}): Promise<string> => {\n if (!parentId) {\n return \"\";\n }\n\n const parentDoc = await req.payload.findByID({\n collection: userSlug,\n id: parentId,\n depth: 0,\n req,\n });\n\n return buildParentPathFromParentDoc(parentDoc as UserDoc);\n};\n\nconst pathContainsId = (parentPath: string, id: string): boolean => {\n if (!parentPath) {\n return false;\n }\n\n return parentPath.split(PARENT_PATH_SEPARATOR).includes(id);\n};\n\nconst validateParentAssignment = async ({\n userId,\n parentId,\n req,\n userSlug,\n}: {\n userId?: string | number;\n parentId?: string;\n req: PayloadRequest;\n userSlug: string;\n}): Promise<string | true> => {\n if (!parentId) {\n return true;\n }\n\n if (userId && String(parentId) === String(userId)) {\n return \"A user cannot be their own parent.\";\n }\n\n if (!userId) {\n return true;\n }\n\n const parentDoc = await req.payload.findByID({\n collection: userSlug,\n id: parentId,\n depth: 0,\n req,\n });\n\n const parentPath = (parentDoc as UserDoc).parentPath ?? \"\";\n\n if (pathContainsId(parentPath, String(userId))) {\n return \"Cannot assign a descendant as parent (would create a cycle).\";\n }\n\n return true;\n};\n\nconst syncDescendantParentPaths = async ({\n userId,\n req,\n userSlug,\n}: {\n userId: string | number;\n req: PayloadRequest;\n userSlug: string;\n}): Promise<void> => {\n const children = await req.payload.find({\n collection: userSlug,\n depth: 0,\n limit: 0,\n pagination: false,\n req,\n where: {\n parent: { equals: userId },\n },\n });\n\n for (const child of children.docs as UserDoc[]) {\n if (!child.id) {\n continue;\n }\n\n const parentId = getParentId(child.parent);\n const nextParentPath = await computeParentPath({\n parentId,\n req,\n userSlug,\n });\n\n if ((child.parentPath ?? \"\") === nextParentPath) {\n await syncDescendantParentPaths({\n userId: child.id,\n req,\n userSlug,\n });\n continue;\n }\n\n await req.payload.update({\n collection: userSlug,\n id: child.id,\n data: { parentPath: nextParentPath },\n depth: 0,\n req,\n overrideAccess: true,\n });\n\n await syncDescendantParentPaths({\n userId: child.id,\n req,\n userSlug,\n });\n }\n};\n\nexport const createUserParentPathHooks = (userSlug: string) => {\n const beforeChange: CollectionBeforeChangeHook = async ({\n data,\n req,\n operation,\n originalDoc,\n }) => {\n const incoming = data as UserDoc;\n const previous = originalDoc as UserDoc | undefined;\n\n const parentRef =\n incoming.parent !== undefined\n ? incoming.parent\n : operation === \"update\"\n ? previous?.parent\n : undefined;\n\n const parentId = getParentId(parentRef);\n\n const validation = await validateParentAssignment({\n userId:\n operation === \"update\"\n ? (previous?.id ?? incoming.id)\n : incoming.id,\n parentId,\n req,\n userSlug,\n });\n\n if (validation !== true) {\n throw new Error(validation);\n }\n\n incoming.parentPath = await computeParentPath({\n parentId,\n req,\n userSlug,\n });\n\n return incoming;\n };\n\n const afterChange: CollectionAfterChangeHook = async ({\n doc,\n previousDoc,\n req,\n operation,\n }) => {\n const current = doc as UserDoc;\n const previous = previousDoc as UserDoc | undefined;\n\n if (!current.id) {\n return doc;\n }\n\n const previousParentId = getParentId(previous?.parent);\n const nextParentId = getParentId(current.parent);\n\n const parentChanged =\n operation === \"create\" || previousParentId !== nextParentId;\n\n if (parentChanged) {\n await syncDescendantParentPaths({\n userId: current.id,\n req,\n userSlug,\n });\n }\n\n return doc;\n };\n\n const afterDelete: CollectionAfterDeleteHook = async ({ doc, req }) => {\n const deleted = doc as UserDoc | undefined;\n\n if (!deleted?.id) {\n return;\n }\n\n const children = await req.payload.find({\n collection: userSlug,\n depth: 0,\n limit: 0,\n pagination: false,\n req,\n where: {\n parent: { equals: deleted.id },\n },\n });\n\n for (const child of children.docs as UserDoc[]) {\n if (!child.id) {\n continue;\n }\n\n await req.payload.update({\n collection: userSlug,\n id: child.id,\n data: {\n parent: null,\n parentPath: \"\",\n },\n depth: 0,\n req,\n overrideAccess: true,\n });\n\n await syncDescendantParentPaths({\n userId: child.id,\n req,\n userSlug,\n });\n }\n };\n\n return { beforeChange, afterChange, afterDelete };\n};\n\nconst mergeHookArrays = <T>(existing: T[] | T | undefined, added: T): T[] => {\n const base = Array.isArray(existing) ? existing : existing ? [existing] : [];\n return [...base, added];\n};\n\nexport const mergeUserCollectionHooks = ({\n existingHooks,\n userSlug,\n}: {\n existingHooks?: {\n beforeChange?: CollectionBeforeChangeHook[] | CollectionBeforeChangeHook;\n afterChange?: CollectionAfterChangeHook[] | CollectionAfterChangeHook;\n afterDelete?: CollectionAfterDeleteHook[] | CollectionAfterDeleteHook;\n };\n userSlug: string;\n}) => {\n const { beforeChange, afterChange, afterDelete } =\n createUserParentPathHooks(userSlug);\n\n return {\n ...existingHooks,\n beforeChange: mergeHookArrays(existingHooks?.beforeChange, beforeChange),\n afterChange: mergeHookArrays(existingHooks?.afterChange, afterChange),\n afterDelete: mergeHookArrays(existingHooks?.afterDelete, afterDelete),\n };\n};\n"],"names":["PARENT_PATH_SEPARATOR","toID","getParentId","parent","id","undefined","buildParentPathFromParentDoc","parentId","String","ancestorPath","parentPath","trim","computeParentPath","req","userSlug","parentDoc","payload","findByID","collection","depth","pathContainsId","split","includes","validateParentAssignment","userId","syncDescendantParentPaths","children","find","limit","pagination","where","equals","child","docs","nextParentPath","update","data","overrideAccess","createUserParentPathHooks","beforeChange","operation","originalDoc","incoming","previous","parentRef","validation","Error","afterChange","doc","previousDoc","current","previousParentId","nextParentId","parentChanged","afterDelete","deleted","mergeHookArrays","existing","added","base","Array","isArray","mergeUserCollectionHooks","existingHooks"],"mappings":"AAMA,SAASA,qBAAqB,QAAQ,8BAA8B;AACpE,SAASC,IAAI,QAAQ,0BAA0B;AAQ/C,MAAMC,cAAc,CAACC;IACnB,MAAMC,KAAKH,KAAKE,UAAUE;IAC1B,OAAOD,MAAMC;AACf;AAEA,wEAAwE,GACxE,OAAO,MAAMC,+BAA+B,CAC1CH;IAEA,IAAI,CAACA,QAAQC,IAAI;QACf,OAAO;IACT;IAEA,MAAMG,WAAWC,OAAOL,OAAOC,EAAE;IACjC,MAAMK,eAAeN,OAAOO,UAAU,EAAEC;IAExC,IAAI,CAACF,cAAc;QACjB,OAAOF;IACT;IAEA,OAAO,GAAGE,eAAeT,wBAAwBO,UAAU;A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EACvCC,aAAa,EACbjD,QAAQ,EAQT;IACC,MAAM,EAAEyB,YAAY,EAAEQ,WAAW,EAAEO,WAAW,EAAE,GAC9ChB,0BAA0BxB;IAE5B,OAAO;QACL,GAAGiD,aAAa;QAChBxB,cAAciB,gBAAgBO,eAAexB,cAAcA;QAC3DQ,aAAaS,gBAAgBO,eAAehB,aAAaA;QACzDO,aAAaE,gBAAgBO,eAAeT,aAAaA;IAC3D;AACF,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/users/types.ts"],"sourcesContent":["import type { Field } from \"payload\";\n\nexport type UsersModificationTranslations = {\n [locale: string]: {\n fields?: {\n isSuperAdmin?: {\n label?: string;\n };\n roles?: {\n label?: string;\n placeholder?: string;\n };\n parent?: {\n label?: string;\n placeholder?: string;\n };\n };\n };\n};\n\nexport type UsersModificationParams = {\n translations?: UsersModificationTranslations;\n fields?: Field[];\n rolesSlug?: string;\n};\n"],"names":[],"mappings":"AAoBA,WAIE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const rolePermissionMatrixClientDefaultTranslations = {
|
|
2
|
+
en: {
|
|
3
|
+
viewInUpdateScreenOnly: {
|
|
4
|
+
label: "View permission matrix in update screen only"
|
|
5
|
+
},
|
|
6
|
+
loading: {
|
|
7
|
+
placeholder: "Loading permission matrix..."
|
|
8
|
+
},
|
|
9
|
+
title: "Permission Matrix",
|
|
10
|
+
features: {
|
|
11
|
+
label: "Features"
|
|
12
|
+
},
|
|
13
|
+
actions: {
|
|
14
|
+
label: "Actions",
|
|
15
|
+
create: "Create",
|
|
16
|
+
read: "Read",
|
|
17
|
+
update: "Update",
|
|
18
|
+
delete: "Delete"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=default-data.js.map
|
|
@@ -0,0 +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"}
|