@webiny/api-headless-cms 0.0.0-unstable.c59b9cc5b9 → 0.0.0-unstable.c7dec08bb0
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/constants.d.ts +1 -0
- package/constants.js +8 -0
- package/constants.js.map +1 -0
- package/context.js +37 -5
- package/context.js.map +1 -1
- package/crud/contentEntry.crud.d.ts +4 -0
- package/crud/contentEntry.crud.js +155 -55
- package/crud/contentEntry.crud.js.map +1 -1
- package/crud/contentModel/validateModelFields.js +1 -1
- package/crud/contentModel/validateModelFields.js.map +1 -1
- package/crud/contentModel/validation.d.ts +76 -76
- package/crud/contentModel.crud.d.ts +2 -0
- package/crud/contentModel.crud.js +22 -12
- package/crud/contentModel.crud.js.map +1 -1
- package/crud/contentModelGroup/validation.d.ts +4 -4
- package/crud/contentModelGroup.crud.d.ts +2 -0
- package/crud/contentModelGroup.crud.js +41 -20
- package/crud/contentModelGroup.crud.js.map +1 -1
- package/crud/settings.crud.d.ts +2 -0
- package/crud/settings.crud.js +2 -6
- package/crud/settings.crud.js.map +1 -1
- package/graphql/getSchema.js +1 -1
- package/graphql/getSchema.js.map +1 -1
- package/graphql/index.d.ts +1 -1
- package/graphql/schema/baseSchema.js +16 -0
- package/graphql/schema/baseSchema.js.map +1 -1
- package/graphql/schema/contentEntries.js +6 -1
- package/graphql/schema/contentEntries.js.map +1 -1
- package/graphql/schema/createManageResolvers.d.ts +1 -1
- package/graphql/schema/createManageResolvers.js +10 -0
- package/graphql/schema/createManageResolvers.js.map +1 -1
- package/graphql/schema/createManageSDL.js +19 -4
- package/graphql/schema/createManageSDL.js.map +1 -1
- package/graphql/schema/createReadSDL.js +1 -0
- package/graphql/schema/createReadSDL.js.map +1 -1
- package/graphql/schema/resolvers/manage/resolveMove.d.ts +8 -0
- package/graphql/schema/resolvers/manage/resolveMove.js +30 -0
- package/graphql/schema/resolvers/manage/resolveMove.js.map +1 -0
- package/graphql/system.d.ts +2 -5
- package/graphql/system.js +1 -11
- package/graphql/system.js.map +1 -1
- package/graphqlFields/number.js +1 -0
- package/graphqlFields/number.js.map +1 -1
- package/graphqlFields/object.js +2 -2
- package/graphqlFields/object.js.map +1 -1
- package/graphqlFields/text.js +2 -0
- package/graphqlFields/text.js.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +19 -23
- package/types.d.ts +38 -5
- package/types.js.map +1 -1
- package/utils/createTypeFromFields.js +1 -1
- package/utils/createTypeFromFields.js.map +1 -1
- package/utils/permissions/EntriesPermissions.d.ts +4 -0
- package/utils/permissions/EntriesPermissions.js +9 -0
- package/utils/permissions/EntriesPermissions.js.map +1 -0
- package/utils/permissions/ModelGroupsPermissions.d.ts +11 -0
- package/utils/permissions/ModelGroupsPermissions.js +48 -0
- package/utils/permissions/ModelGroupsPermissions.js.map +1 -0
- package/utils/permissions/ModelsPermissions.d.ts +20 -0
- package/utils/permissions/ModelsPermissions.js +91 -0
- package/utils/permissions/ModelsPermissions.js.map +1 -0
- package/utils/permissions/SettingsPermissions.d.ts +4 -0
- package/utils/permissions/SettingsPermissions.js +9 -0
- package/utils/permissions/SettingsPermissions.js.map +1 -0
- package/utils/renderListFilterFields.d.ts +1 -0
- package/utils/renderListFilterFields.js +10 -4
- package/utils/renderListFilterFields.js.map +1 -1
- package/utils/renderSortEnum.d.ts +1 -1
- package/utils/renderSortEnum.js +3 -0
- package/utils/renderSortEnum.js.map +1 -1
- package/utils/access.d.ts +0 -8
- package/utils/access.js +0 -76
- package/utils/access.js.map +0 -1
- package/utils/ownership.d.ts +0 -8
- package/utils/ownership.js +0 -33
- package/utils/ownership.js.map +0 -1
- package/utils/permissions.d.ts +0 -7
- package/utils/permissions.js +0 -91
- package/utils/permissions.js.map +0 -1
package/constants.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ROOT_FOLDER = "root";
|
package/constants.js
ADDED
package/constants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ROOT_FOLDER"],"sources":["constants.ts"],"sourcesContent":["export const ROOT_FOLDER = \"root\";\n"],"mappings":";;;;;;AAAO,MAAMA,WAAW,GAAG,MAAM;AAAC"}
|
package/context.js
CHANGED
|
@@ -16,6 +16,10 @@ var _contentModel = require("./crud/contentModel.crud");
|
|
|
16
16
|
var _contentEntry = require("./crud/contentEntry.crud");
|
|
17
17
|
var _plugins = require("./plugins");
|
|
18
18
|
var _valueKeyStorageConverter = require("./utils/converters/valueKeyStorageConverter");
|
|
19
|
+
var _ModelsPermissions = require("./utils/permissions/ModelsPermissions");
|
|
20
|
+
var _ModelGroupsPermissions = require("./utils/permissions/ModelGroupsPermissions");
|
|
21
|
+
var _EntriesPermissions = require("./utils/permissions/EntriesPermissions");
|
|
22
|
+
var _SettingsPermissions = require("./utils/permissions/SettingsPermissions");
|
|
19
23
|
const getParameters = async context => {
|
|
20
24
|
const plugins = context.plugins.byType(_CmsParametersPlugin.CmsParametersPlugin.type);
|
|
21
25
|
for (const plugin of plugins) {
|
|
@@ -29,7 +33,7 @@ const getParameters = async context => {
|
|
|
29
33
|
const createContextPlugin = ({
|
|
30
34
|
storageOperations
|
|
31
35
|
}) => {
|
|
32
|
-
|
|
36
|
+
const plugin = new _api.ContextPlugin(async context => {
|
|
33
37
|
const {
|
|
34
38
|
type,
|
|
35
39
|
locale
|
|
@@ -50,6 +54,27 @@ const createContextPlugin = ({
|
|
|
50
54
|
context.plugins.register(new _plugins.StorageOperationsCmsModelPlugin((0, _valueKeyStorageConverter.createCmsModelFieldConvertersAttachFactory)(context.plugins)));
|
|
51
55
|
await context.benchmark.measure("headlessCms.createContext", async () => {
|
|
52
56
|
await storageOperations.beforeInit(context);
|
|
57
|
+
const modelGroupsPermissions = new _ModelGroupsPermissions.ModelGroupsPermissions({
|
|
58
|
+
getIdentity: context.security.getIdentity,
|
|
59
|
+
getPermissions: () => context.security.getPermissions("cms.contentModelGroup"),
|
|
60
|
+
fullAccessPermissionName: "cms.*"
|
|
61
|
+
});
|
|
62
|
+
const modelsPermissions = new _ModelsPermissions.ModelsPermissions({
|
|
63
|
+
getIdentity: context.security.getIdentity,
|
|
64
|
+
getPermissions: () => context.security.getPermissions("cms.contentModel"),
|
|
65
|
+
fullAccessPermissionName: "cms.*",
|
|
66
|
+
modelGroupsPermissions
|
|
67
|
+
});
|
|
68
|
+
const entriesPermissions = new _EntriesPermissions.EntriesPermissions({
|
|
69
|
+
getIdentity: context.security.getIdentity,
|
|
70
|
+
getPermissions: () => context.security.getPermissions("cms.contentEntry"),
|
|
71
|
+
fullAccessPermissionName: "cms.*"
|
|
72
|
+
});
|
|
73
|
+
const settingsPermissions = new _SettingsPermissions.SettingsPermissions({
|
|
74
|
+
getIdentity: context.security.getIdentity,
|
|
75
|
+
getPermissions: () => context.security.getPermissions("cms.settings"),
|
|
76
|
+
fullAccessPermissionName: "cms.*"
|
|
77
|
+
});
|
|
53
78
|
context.cms = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
54
79
|
type,
|
|
55
80
|
locale,
|
|
@@ -68,25 +93,30 @@ const createContextPlugin = ({
|
|
|
68
93
|
context,
|
|
69
94
|
getTenant,
|
|
70
95
|
getLocale,
|
|
71
|
-
storageOperations
|
|
96
|
+
storageOperations,
|
|
97
|
+
settingsPermissions
|
|
72
98
|
})), (0, _contentModelGroup.createModelGroupsCrud)({
|
|
73
99
|
context,
|
|
74
100
|
getTenant,
|
|
75
101
|
getLocale,
|
|
76
102
|
getIdentity,
|
|
77
|
-
storageOperations
|
|
103
|
+
storageOperations,
|
|
104
|
+
modelGroupsPermissions
|
|
78
105
|
})), (0, _contentModel.createModelsCrud)({
|
|
79
106
|
context,
|
|
80
107
|
getLocale,
|
|
81
108
|
getTenant,
|
|
82
109
|
getIdentity,
|
|
83
|
-
storageOperations
|
|
110
|
+
storageOperations,
|
|
111
|
+
modelsPermissions
|
|
84
112
|
})), (0, _contentEntry.createContentEntryCrud)({
|
|
85
113
|
context,
|
|
86
114
|
getIdentity,
|
|
87
115
|
getTenant,
|
|
88
116
|
getLocale,
|
|
89
|
-
storageOperations
|
|
117
|
+
storageOperations,
|
|
118
|
+
entriesPermissions,
|
|
119
|
+
modelsPermissions
|
|
90
120
|
}));
|
|
91
121
|
if (!storageOperations.init) {
|
|
92
122
|
return;
|
|
@@ -94,5 +124,7 @@ const createContextPlugin = ({
|
|
|
94
124
|
await storageOperations.init(context);
|
|
95
125
|
});
|
|
96
126
|
});
|
|
127
|
+
plugin.name = "cms.createContext";
|
|
128
|
+
return plugin;
|
|
97
129
|
};
|
|
98
130
|
exports.createContextPlugin = createContextPlugin;
|
package/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getParameters","context","plugins","byType","CmsParametersPlugin","type","plugin","result","WebinyError","createContextPlugin","storageOperations","ContextPlugin","locale","getLocale","systemLocale","i18n","getIdentity","security","getTenant","tenancy","getCurrentTenant","register","StorageOperationsCmsModelPlugin","createCmsModelFieldConvertersAttachFactory","benchmark","measure","beforeInit","cms","READ","PREVIEW","MANAGE","createSystemCrud","createSettingsCrud","createModelGroupsCrud","createModelsCrud","createContentEntryCrud","init"],"sources":["context.ts"],"sourcesContent":["import { CmsContext, HeadlessCmsStorageOperations } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { CmsParametersPlugin, CmsParametersPluginResponse } from \"~/plugins/CmsParametersPlugin\";\nimport { createSystemCrud } from \"~/crud/system.crud\";\nimport { createSettingsCrud } from \"~/crud/settings.crud\";\nimport { createModelGroupsCrud } from \"~/crud/contentModelGroup.crud\";\nimport { createModelsCrud } from \"~/crud/contentModel.crud\";\nimport { createContentEntryCrud } from \"~/crud/contentEntry.crud\";\nimport { StorageOperationsCmsModelPlugin } from \"~/plugins\";\nimport { createCmsModelFieldConvertersAttachFactory } from \"~/utils/converters/valueKeyStorageConverter\";\n\nconst getParameters = async (context: CmsContext): Promise<CmsParametersPluginResponse> => {\n const plugins = context.plugins.byType<CmsParametersPlugin>(CmsParametersPlugin.type);\n\n for (const plugin of plugins) {\n const result = await plugin.getParameters(context);\n if (result !== null) {\n return result;\n }\n }\n throw new WebinyError(\n \"Could not determine locale and/or type of the CMS.\",\n \"CMS_LOCALE_AND_TYPE_ERROR\"\n );\n};\n\nexport interface CrudParams {\n storageOperations: HeadlessCmsStorageOperations;\n}\n\nexport const createContextPlugin = ({ storageOperations }: CrudParams) => {\n
|
|
1
|
+
{"version":3,"names":["getParameters","context","plugins","byType","CmsParametersPlugin","type","plugin","result","WebinyError","createContextPlugin","storageOperations","ContextPlugin","locale","getLocale","systemLocale","i18n","getIdentity","security","getTenant","tenancy","getCurrentTenant","register","StorageOperationsCmsModelPlugin","createCmsModelFieldConvertersAttachFactory","benchmark","measure","beforeInit","modelGroupsPermissions","ModelGroupsPermissions","getPermissions","fullAccessPermissionName","modelsPermissions","ModelsPermissions","entriesPermissions","EntriesPermissions","settingsPermissions","SettingsPermissions","cms","READ","PREVIEW","MANAGE","createSystemCrud","createSettingsCrud","createModelGroupsCrud","createModelsCrud","createContentEntryCrud","init","name"],"sources":["context.ts"],"sourcesContent":["import { CmsContext, HeadlessCmsStorageOperations } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { CmsParametersPlugin, CmsParametersPluginResponse } from \"~/plugins/CmsParametersPlugin\";\nimport { createSystemCrud } from \"~/crud/system.crud\";\nimport { createSettingsCrud } from \"~/crud/settings.crud\";\nimport { createModelGroupsCrud } from \"~/crud/contentModelGroup.crud\";\nimport { createModelsCrud } from \"~/crud/contentModel.crud\";\nimport { createContentEntryCrud } from \"~/crud/contentEntry.crud\";\nimport { StorageOperationsCmsModelPlugin } from \"~/plugins\";\nimport { createCmsModelFieldConvertersAttachFactory } from \"~/utils/converters/valueKeyStorageConverter\";\nimport { ModelsPermissions } from \"~/utils/permissions/ModelsPermissions\";\nimport { ModelGroupsPermissions } from \"./utils/permissions/ModelGroupsPermissions\";\nimport { EntriesPermissions } from \"./utils/permissions/EntriesPermissions\";\nimport { SettingsPermissions } from \"./utils/permissions/SettingsPermissions\";\n\nconst getParameters = async (context: CmsContext): Promise<CmsParametersPluginResponse> => {\n const plugins = context.plugins.byType<CmsParametersPlugin>(CmsParametersPlugin.type);\n\n for (const plugin of plugins) {\n const result = await plugin.getParameters(context);\n if (result !== null) {\n return result;\n }\n }\n throw new WebinyError(\n \"Could not determine locale and/or type of the CMS.\",\n \"CMS_LOCALE_AND_TYPE_ERROR\"\n );\n};\n\nexport interface CrudParams {\n storageOperations: HeadlessCmsStorageOperations;\n}\n\nexport const createContextPlugin = ({ storageOperations }: CrudParams) => {\n const plugin = new ContextPlugin<CmsContext>(async context => {\n const { type, locale } = await getParameters(context);\n\n const getLocale = () => {\n const systemLocale = context.i18n.getLocale(locale);\n if (!systemLocale) {\n throw new WebinyError(`There is no locale \"${locale}\" in the system.`);\n }\n return systemLocale;\n };\n\n const getIdentity = () => {\n return context.security.getIdentity();\n };\n\n const getTenant = () => {\n return context.tenancy.getCurrentTenant();\n };\n\n context.plugins.register(\n new StorageOperationsCmsModelPlugin(\n createCmsModelFieldConvertersAttachFactory(context.plugins)\n )\n );\n\n await context.benchmark.measure(\"headlessCms.createContext\", async () => {\n await storageOperations.beforeInit(context);\n\n const modelGroupsPermissions = new ModelGroupsPermissions({\n getIdentity: context.security.getIdentity,\n getPermissions: () => context.security.getPermissions(\"cms.contentModelGroup\"),\n fullAccessPermissionName: \"cms.*\"\n });\n\n const modelsPermissions = new ModelsPermissions({\n getIdentity: context.security.getIdentity,\n getPermissions: () => context.security.getPermissions(\"cms.contentModel\"),\n fullAccessPermissionName: \"cms.*\",\n modelGroupsPermissions\n });\n\n const entriesPermissions = new EntriesPermissions({\n getIdentity: context.security.getIdentity,\n getPermissions: () => context.security.getPermissions(\"cms.contentEntry\"),\n fullAccessPermissionName: \"cms.*\"\n });\n\n const settingsPermissions = new SettingsPermissions({\n getIdentity: context.security.getIdentity,\n getPermissions: () => context.security.getPermissions(\"cms.settings\"),\n fullAccessPermissionName: \"cms.*\"\n });\n\n context.cms = {\n type,\n locale,\n getLocale,\n READ: type === \"read\",\n PREVIEW: type === \"preview\",\n MANAGE: type === \"manage\",\n storageOperations,\n ...createSystemCrud({\n context,\n getTenant,\n getLocale,\n getIdentity,\n storageOperations\n }),\n ...createSettingsCrud({\n context,\n getTenant,\n getLocale,\n storageOperations,\n settingsPermissions\n }),\n ...createModelGroupsCrud({\n context,\n getTenant,\n getLocale,\n getIdentity,\n storageOperations,\n modelGroupsPermissions\n }),\n ...createModelsCrud({\n context,\n getLocale,\n getTenant,\n getIdentity,\n storageOperations,\n modelsPermissions\n }),\n ...createContentEntryCrud({\n context,\n getIdentity,\n getTenant,\n getLocale,\n storageOperations,\n entriesPermissions,\n modelsPermissions\n })\n };\n\n if (!storageOperations.init) {\n return;\n }\n await storageOperations.init(context);\n });\n });\n\n plugin.name = \"cms.createContext\";\n\n return plugin;\n};\n"],"mappings":"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"}
|
|
@@ -2,11 +2,15 @@ import { CmsContext, CmsEntryContext, CONTENT_ENTRY_STATUS, HeadlessCmsStorageOp
|
|
|
2
2
|
import { SecurityIdentity } from "@webiny/api-security/types";
|
|
3
3
|
import { Tenant } from "@webiny/api-tenancy/types";
|
|
4
4
|
import { I18NLocale } from "@webiny/api-i18n/types";
|
|
5
|
+
import { EntriesPermissions } from "../utils/permissions/EntriesPermissions";
|
|
6
|
+
import { ModelsPermissions } from "../utils/permissions/ModelsPermissions";
|
|
5
7
|
export declare const STATUS_DRAFT = CONTENT_ENTRY_STATUS.DRAFT;
|
|
6
8
|
export declare const STATUS_PUBLISHED = CONTENT_ENTRY_STATUS.PUBLISHED;
|
|
7
9
|
export declare const STATUS_UNPUBLISHED = CONTENT_ENTRY_STATUS.UNPUBLISHED;
|
|
8
10
|
interface CreateContentEntryCrudParams {
|
|
9
11
|
storageOperations: HeadlessCmsStorageOperations;
|
|
12
|
+
entriesPermissions: EntriesPermissions;
|
|
13
|
+
modelsPermissions: ModelsPermissions;
|
|
10
14
|
context: CmsContext;
|
|
11
15
|
getIdentity: () => SecurityIdentity;
|
|
12
16
|
getTenant: () => Tenant;
|
|
@@ -17,12 +17,11 @@ var _beforeCreate = require("./contentEntry/beforeCreate");
|
|
|
17
17
|
var _beforeUpdate = require("./contentEntry/beforeUpdate");
|
|
18
18
|
var _afterDelete = require("./contentEntry/afterDelete");
|
|
19
19
|
var _referenceFieldsMapping = require("./contentEntry/referenceFieldsMapping");
|
|
20
|
-
var _permissions = require("../utils/permissions");
|
|
21
|
-
var _access = require("../utils/access");
|
|
22
|
-
var _ownership = require("../utils/ownership");
|
|
23
20
|
var _entryStorage = require("../utils/entryStorage");
|
|
24
21
|
var _searchableFields = require("./contentEntry/searchableFields");
|
|
25
22
|
var _filterAsync = require("../utils/filterAsync");
|
|
23
|
+
var _apiSecurity = require("@webiny/api-security/");
|
|
24
|
+
var _constants = require("../constants");
|
|
26
25
|
const STATUS_DRAFT = _types.CONTENT_ENTRY_STATUS.DRAFT;
|
|
27
26
|
exports.STATUS_DRAFT = STATUS_DRAFT;
|
|
28
27
|
const STATUS_PUBLISHED = _types.CONTENT_ENTRY_STATUS.PUBLISHED;
|
|
@@ -171,9 +170,19 @@ const allowedEntryStatus = ["draft", "published", "unpublished"];
|
|
|
171
170
|
const transformEntryStatus = status => {
|
|
172
171
|
return allowedEntryStatus.includes(status) ? status : "draft";
|
|
173
172
|
};
|
|
173
|
+
const createSort = sort => {
|
|
174
|
+
if (!Array.isArray(sort)) {
|
|
175
|
+
return ["createdOn_DESC"];
|
|
176
|
+
} else if (sort.filter(s => !!s).length === 0) {
|
|
177
|
+
return ["createdOn_DESC"];
|
|
178
|
+
}
|
|
179
|
+
return sort;
|
|
180
|
+
};
|
|
174
181
|
const createContentEntryCrud = params => {
|
|
175
182
|
const {
|
|
176
183
|
storageOperations,
|
|
184
|
+
entriesPermissions,
|
|
185
|
+
modelsPermissions,
|
|
177
186
|
context,
|
|
178
187
|
getIdentity,
|
|
179
188
|
getTenant,
|
|
@@ -275,9 +284,6 @@ const createContentEntryCrud = params => {
|
|
|
275
284
|
context,
|
|
276
285
|
onEntryAfterDelete
|
|
277
286
|
});
|
|
278
|
-
const checkEntryPermissions = check => {
|
|
279
|
-
return (0, _permissions.checkPermissions)(context, "cms.contentEntry", check);
|
|
280
|
-
};
|
|
281
287
|
|
|
282
288
|
/**
|
|
283
289
|
* A helper to delete the entire entry.
|
|
@@ -317,14 +323,23 @@ const createContentEntryCrud = params => {
|
|
|
317
323
|
*/
|
|
318
324
|
const getEntriesByIds = async (model, ids) => {
|
|
319
325
|
return context.benchmark.measure("headlessCms.crud.entries.getEntriesByIds", async () => {
|
|
320
|
-
|
|
326
|
+
await entriesPermissions.ensure({
|
|
321
327
|
rwd: "r"
|
|
322
328
|
});
|
|
323
|
-
await
|
|
329
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
330
|
+
model,
|
|
331
|
+
locale: getLocale().code
|
|
332
|
+
});
|
|
324
333
|
const entries = await storageOperations.entries.getByIds(model, {
|
|
325
334
|
ids
|
|
326
335
|
});
|
|
327
|
-
return
|
|
336
|
+
return (0, _filterAsync.filterAsync)(entries, async entry => {
|
|
337
|
+
return entriesPermissions.ensure({
|
|
338
|
+
owns: entry.createdBy
|
|
339
|
+
}, {
|
|
340
|
+
throw: false
|
|
341
|
+
});
|
|
342
|
+
});
|
|
328
343
|
});
|
|
329
344
|
};
|
|
330
345
|
const getEntryById = async (model, id) => {
|
|
@@ -342,27 +357,45 @@ const createContentEntryCrud = params => {
|
|
|
342
357
|
return entry;
|
|
343
358
|
};
|
|
344
359
|
const getPublishedEntriesByIds = async (model, ids) => {
|
|
345
|
-
|
|
360
|
+
await entriesPermissions.ensure({
|
|
346
361
|
rwd: "r"
|
|
347
362
|
});
|
|
348
|
-
await
|
|
363
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
364
|
+
model,
|
|
365
|
+
locale: getLocale().code
|
|
366
|
+
});
|
|
349
367
|
const entries = await storageOperations.entries.getPublishedByIds(model, {
|
|
350
368
|
ids
|
|
351
369
|
});
|
|
352
|
-
return
|
|
370
|
+
return (0, _filterAsync.filterAsync)(entries, async entry => {
|
|
371
|
+
return entriesPermissions.ensure({
|
|
372
|
+
owns: entry.createdBy
|
|
373
|
+
}, {
|
|
374
|
+
throw: false
|
|
375
|
+
});
|
|
376
|
+
});
|
|
353
377
|
};
|
|
354
378
|
const getLatestEntriesByIds = async (model, ids) => {
|
|
355
|
-
|
|
379
|
+
await entriesPermissions.ensure({
|
|
356
380
|
rwd: "r"
|
|
357
381
|
});
|
|
358
|
-
await
|
|
382
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
383
|
+
model,
|
|
384
|
+
locale: getLocale().code
|
|
385
|
+
});
|
|
359
386
|
const entries = await storageOperations.entries.getLatestByIds(model, {
|
|
360
387
|
ids
|
|
361
388
|
});
|
|
362
|
-
return
|
|
389
|
+
return (0, _filterAsync.filterAsync)(entries, async entry => {
|
|
390
|
+
return entriesPermissions.ensure({
|
|
391
|
+
owns: entry.createdBy
|
|
392
|
+
}, {
|
|
393
|
+
throw: false
|
|
394
|
+
});
|
|
395
|
+
});
|
|
363
396
|
};
|
|
364
397
|
const getEntry = async (model, params) => {
|
|
365
|
-
await
|
|
398
|
+
await entriesPermissions.ensure({
|
|
366
399
|
rwd: "r"
|
|
367
400
|
});
|
|
368
401
|
const {
|
|
@@ -390,10 +423,21 @@ const createContentEntryCrud = params => {
|
|
|
390
423
|
});
|
|
391
424
|
};
|
|
392
425
|
const listEntries = async (model, params) => {
|
|
393
|
-
|
|
394
|
-
|
|
426
|
+
try {
|
|
427
|
+
await entriesPermissions.ensure({
|
|
428
|
+
rwd: "r"
|
|
429
|
+
});
|
|
430
|
+
} catch {
|
|
431
|
+
throw new _apiSecurity.NotAuthorizedError({
|
|
432
|
+
data: {
|
|
433
|
+
reason: 'Not allowed to perform "read" on "cms.contentEntry".'
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
438
|
+
model,
|
|
439
|
+
locale: getLocale().code
|
|
395
440
|
});
|
|
396
|
-
await (0, _access.checkModelAccess)(context, model);
|
|
397
441
|
const {
|
|
398
442
|
where: initialWhere,
|
|
399
443
|
limit: initialLimit
|
|
@@ -404,10 +448,10 @@ const createContentEntryCrud = params => {
|
|
|
404
448
|
* Possibly only get records which are owned by current user.
|
|
405
449
|
* Or if searching for the owner set that value - in the case that user can see other entries than their own.
|
|
406
450
|
*/
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
where.ownedBy = ownedBy;
|
|
451
|
+
if (await entriesPermissions.canAccessOnlyOwnRecords()) {
|
|
452
|
+
where.ownedBy = getIdentity().id;
|
|
410
453
|
}
|
|
454
|
+
|
|
411
455
|
/**
|
|
412
456
|
* Where must contain either latest or published keys.
|
|
413
457
|
* We cannot list entries without one of those
|
|
@@ -437,6 +481,7 @@ const createContentEntryCrud = params => {
|
|
|
437
481
|
cursor,
|
|
438
482
|
items
|
|
439
483
|
} = await storageOperations.entries.list(model, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
|
|
484
|
+
sort: createSort(params.sort),
|
|
440
485
|
limit,
|
|
441
486
|
where,
|
|
442
487
|
fields
|
|
@@ -465,10 +510,14 @@ const createContentEntryCrud = params => {
|
|
|
465
510
|
}
|
|
466
511
|
};
|
|
467
512
|
const createEntry = async (model, inputData) => {
|
|
468
|
-
|
|
513
|
+
var _inputData$wbyAco_loc;
|
|
514
|
+
await entriesPermissions.ensure({
|
|
469
515
|
rwd: "w"
|
|
470
516
|
});
|
|
471
|
-
await
|
|
517
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
518
|
+
model,
|
|
519
|
+
locale: getLocale().code
|
|
520
|
+
});
|
|
472
521
|
|
|
473
522
|
/**
|
|
474
523
|
* Make sure we only work with fields that are defined in the model.
|
|
@@ -511,7 +560,10 @@ const createContentEntryCrud = params => {
|
|
|
511
560
|
version,
|
|
512
561
|
locked: false,
|
|
513
562
|
status: STATUS_DRAFT,
|
|
514
|
-
values: input
|
|
563
|
+
values: input,
|
|
564
|
+
location: {
|
|
565
|
+
folderId: ((_inputData$wbyAco_loc = inputData.wbyAco_location) === null || _inputData$wbyAco_loc === void 0 ? void 0 : _inputData$wbyAco_loc.folderId) || _constants.ROOT_FOLDER
|
|
566
|
+
}
|
|
515
567
|
};
|
|
516
568
|
let storageEntry = null;
|
|
517
569
|
try {
|
|
@@ -548,10 +600,13 @@ const createContentEntryCrud = params => {
|
|
|
548
600
|
}
|
|
549
601
|
};
|
|
550
602
|
const createEntryRevisionFrom = async (model, sourceId, inputData) => {
|
|
551
|
-
|
|
603
|
+
await entriesPermissions.ensure({
|
|
552
604
|
rwd: "w"
|
|
553
605
|
});
|
|
554
|
-
await
|
|
606
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
607
|
+
model,
|
|
608
|
+
locale: getLocale().code
|
|
609
|
+
});
|
|
555
610
|
|
|
556
611
|
/**
|
|
557
612
|
* Make sure we only work with fields that are defined in the model.
|
|
@@ -591,7 +646,9 @@ const createContentEntryCrud = params => {
|
|
|
591
646
|
input: initialValues,
|
|
592
647
|
validateEntries: false
|
|
593
648
|
});
|
|
594
|
-
|
|
649
|
+
await entriesPermissions.ensure({
|
|
650
|
+
owns: originalEntry.createdBy
|
|
651
|
+
});
|
|
595
652
|
const identity = getIdentity();
|
|
596
653
|
const latestId = latestStorageEntry ? latestStorageEntry.id : sourceId;
|
|
597
654
|
const {
|
|
@@ -653,10 +710,14 @@ const createContentEntryCrud = params => {
|
|
|
653
710
|
}
|
|
654
711
|
};
|
|
655
712
|
const updateEntry = async (model, id, inputData, metaInput) => {
|
|
656
|
-
|
|
713
|
+
var _inputData$wbyAco_loc2;
|
|
714
|
+
await entriesPermissions.ensure({
|
|
657
715
|
rwd: "w"
|
|
658
716
|
});
|
|
659
|
-
await
|
|
717
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
718
|
+
model,
|
|
719
|
+
locale: getLocale().code
|
|
720
|
+
});
|
|
660
721
|
|
|
661
722
|
/**
|
|
662
723
|
* Make sure we only work with fields that are defined in the model.
|
|
@@ -682,7 +743,9 @@ const createContentEntryCrud = params => {
|
|
|
682
743
|
data: input,
|
|
683
744
|
entry: originalEntry
|
|
684
745
|
});
|
|
685
|
-
|
|
746
|
+
await entriesPermissions.ensure({
|
|
747
|
+
owns: originalEntry.createdBy
|
|
748
|
+
});
|
|
686
749
|
const initialValues = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, originalEntry.values), input);
|
|
687
750
|
const values = await (0, _referenceFieldsMapping.referenceFieldsMapping)({
|
|
688
751
|
context,
|
|
@@ -704,6 +767,12 @@ const createContentEntryCrud = params => {
|
|
|
704
767
|
meta,
|
|
705
768
|
status: transformEntryStatus(originalEntry.status)
|
|
706
769
|
});
|
|
770
|
+
const folderId = (_inputData$wbyAco_loc2 = inputData.wbyAco_location) === null || _inputData$wbyAco_loc2 === void 0 ? void 0 : _inputData$wbyAco_loc2.folderId;
|
|
771
|
+
if (folderId) {
|
|
772
|
+
entry.location = {
|
|
773
|
+
folderId
|
|
774
|
+
};
|
|
775
|
+
}
|
|
707
776
|
let storageEntry = null;
|
|
708
777
|
try {
|
|
709
778
|
await onEntryBeforeUpdate.publish({
|
|
@@ -742,10 +811,14 @@ const createContentEntryCrud = params => {
|
|
|
742
811
|
}
|
|
743
812
|
};
|
|
744
813
|
const republishEntry = async (model, id) => {
|
|
745
|
-
await
|
|
814
|
+
await entriesPermissions.ensure({
|
|
746
815
|
rwd: "w"
|
|
747
816
|
});
|
|
748
|
-
await
|
|
817
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
818
|
+
model,
|
|
819
|
+
locale: getLocale().code
|
|
820
|
+
});
|
|
821
|
+
|
|
749
822
|
/**
|
|
750
823
|
* Fetch the entry from the storage.
|
|
751
824
|
*/
|
|
@@ -820,10 +893,13 @@ const createContentEntryCrud = params => {
|
|
|
820
893
|
}
|
|
821
894
|
};
|
|
822
895
|
const deleteEntryRevision = async (model, revisionId) => {
|
|
823
|
-
|
|
896
|
+
await entriesPermissions.ensure({
|
|
824
897
|
rwd: "d"
|
|
825
898
|
});
|
|
826
|
-
await
|
|
899
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
900
|
+
model,
|
|
901
|
+
locale: getLocale().code
|
|
902
|
+
});
|
|
827
903
|
const {
|
|
828
904
|
id: entryId,
|
|
829
905
|
version
|
|
@@ -841,7 +917,9 @@ const createContentEntryCrud = params => {
|
|
|
841
917
|
if (!storageEntryToDelete) {
|
|
842
918
|
throw new _handlerGraphql.NotFoundError(`Entry "${revisionId}" was not found!`);
|
|
843
919
|
}
|
|
844
|
-
|
|
920
|
+
await entriesPermissions.ensure({
|
|
921
|
+
owns: storageEntryToDelete.createdBy
|
|
922
|
+
});
|
|
845
923
|
const latestEntryRevisionId = latestStorageEntry ? latestStorageEntry.id : null;
|
|
846
924
|
const entryToDelete = await (0, _entryStorage.entryFromStorageTransform)(context, model, storageEntryToDelete);
|
|
847
925
|
/**
|
|
@@ -911,10 +989,13 @@ const createContentEntryCrud = params => {
|
|
|
911
989
|
entries: ids
|
|
912
990
|
});
|
|
913
991
|
}
|
|
914
|
-
|
|
992
|
+
await entriesPermissions.ensure({
|
|
915
993
|
rwd: "d"
|
|
916
994
|
});
|
|
917
|
-
await
|
|
995
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
996
|
+
model,
|
|
997
|
+
locale: getLocale().code
|
|
998
|
+
});
|
|
918
999
|
const {
|
|
919
1000
|
items: entries
|
|
920
1001
|
} = await storageOperations.entries.list(model, {
|
|
@@ -928,7 +1009,11 @@ const createContentEntryCrud = params => {
|
|
|
928
1009
|
* We do not want to allow deleting entries that user does not own or cannot access.
|
|
929
1010
|
*/
|
|
930
1011
|
const items = (await (0, _filterAsync.filterAsync)(entries, async entry => {
|
|
931
|
-
return
|
|
1012
|
+
return entriesPermissions.ensure({
|
|
1013
|
+
owns: entry.createdBy
|
|
1014
|
+
}, {
|
|
1015
|
+
throw: false
|
|
1016
|
+
});
|
|
932
1017
|
})).map(entry => entry.id);
|
|
933
1018
|
try {
|
|
934
1019
|
await onEntryBeforeDeleteMultiple.publish({
|
|
@@ -963,10 +1048,13 @@ const createContentEntryCrud = params => {
|
|
|
963
1048
|
}
|
|
964
1049
|
};
|
|
965
1050
|
const deleteEntry = async (model, id, options) => {
|
|
966
|
-
|
|
1051
|
+
await entriesPermissions.ensure({
|
|
967
1052
|
rwd: "d"
|
|
968
1053
|
});
|
|
969
|
-
await
|
|
1054
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
1055
|
+
model,
|
|
1056
|
+
locale: getLocale().code
|
|
1057
|
+
});
|
|
970
1058
|
const {
|
|
971
1059
|
force
|
|
972
1060
|
} = options || {};
|
|
@@ -998,7 +1086,9 @@ const createContentEntryCrud = params => {
|
|
|
998
1086
|
}
|
|
999
1087
|
});
|
|
1000
1088
|
}
|
|
1001
|
-
|
|
1089
|
+
await entriesPermissions.ensure({
|
|
1090
|
+
owns: storageEntry.createdBy
|
|
1091
|
+
});
|
|
1002
1092
|
const entry = await (0, _entryStorage.entryFromStorageTransform)(context, model, storageEntry);
|
|
1003
1093
|
return await deleteEntryHelper({
|
|
1004
1094
|
model,
|
|
@@ -1006,17 +1096,22 @@ const createContentEntryCrud = params => {
|
|
|
1006
1096
|
});
|
|
1007
1097
|
};
|
|
1008
1098
|
const publishEntry = async (model, id) => {
|
|
1009
|
-
|
|
1099
|
+
await entriesPermissions.ensure({
|
|
1010
1100
|
pw: "p"
|
|
1011
1101
|
});
|
|
1012
|
-
await
|
|
1102
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
1103
|
+
model,
|
|
1104
|
+
locale: getLocale().code
|
|
1105
|
+
});
|
|
1013
1106
|
const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {
|
|
1014
1107
|
id
|
|
1015
1108
|
});
|
|
1016
1109
|
if (!originalStorageEntry) {
|
|
1017
1110
|
throw new _handlerGraphql.NotFoundError(`Entry "${id}" in the model "${model.modelId}" was not found.`);
|
|
1018
1111
|
}
|
|
1019
|
-
|
|
1112
|
+
await entriesPermissions.ensure({
|
|
1113
|
+
owns: originalStorageEntry.createdBy
|
|
1114
|
+
});
|
|
1020
1115
|
const originalEntry = await (0, _entryStorage.entryFromStorageTransform)(context, model, originalStorageEntry);
|
|
1021
1116
|
const currentDate = new Date().toISOString();
|
|
1022
1117
|
const entry = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, originalEntry), {}, {
|
|
@@ -1058,7 +1153,7 @@ const createContentEntryCrud = params => {
|
|
|
1058
1153
|
}
|
|
1059
1154
|
};
|
|
1060
1155
|
const unpublishEntry = async (model, id) => {
|
|
1061
|
-
|
|
1156
|
+
await entriesPermissions.ensure({
|
|
1062
1157
|
pw: "u"
|
|
1063
1158
|
});
|
|
1064
1159
|
const {
|
|
@@ -1075,7 +1170,9 @@ const createContentEntryCrud = params => {
|
|
|
1075
1170
|
entry: originalStorageEntry
|
|
1076
1171
|
});
|
|
1077
1172
|
}
|
|
1078
|
-
|
|
1173
|
+
await entriesPermissions.ensure({
|
|
1174
|
+
owns: originalStorageEntry.createdBy
|
|
1175
|
+
});
|
|
1079
1176
|
const originalEntry = await (0, _entryStorage.entryFromStorageTransform)(context, model, originalStorageEntry);
|
|
1080
1177
|
const entry = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, originalEntry), {}, {
|
|
1081
1178
|
status: STATUS_UNPUBLISHED
|
|
@@ -1112,10 +1209,13 @@ const createContentEntryCrud = params => {
|
|
|
1112
1209
|
}
|
|
1113
1210
|
};
|
|
1114
1211
|
const getUniqueFieldValues = async (model, params) => {
|
|
1115
|
-
|
|
1212
|
+
await entriesPermissions.ensure({
|
|
1116
1213
|
rwd: "r"
|
|
1117
1214
|
});
|
|
1118
|
-
await
|
|
1215
|
+
await modelsPermissions.ensureCanAccessModel({
|
|
1216
|
+
model,
|
|
1217
|
+
locale: getLocale().code
|
|
1218
|
+
});
|
|
1119
1219
|
const {
|
|
1120
1220
|
where: initialWhere,
|
|
1121
1221
|
fieldId
|
|
@@ -1125,10 +1225,10 @@ const createContentEntryCrud = params => {
|
|
|
1125
1225
|
* Possibly only get records which are owned by current user.
|
|
1126
1226
|
* Or if searching for the owner set that value - in the case that user can see other entries than their own.
|
|
1127
1227
|
*/
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
where.ownedBy = ownedBy;
|
|
1228
|
+
if (await entriesPermissions.canAccessOnlyOwnRecords()) {
|
|
1229
|
+
where.ownedBy = getIdentity().id;
|
|
1131
1230
|
}
|
|
1231
|
+
|
|
1132
1232
|
/**
|
|
1133
1233
|
* Where must contain either latest or published keys.
|
|
1134
1234
|
* We cannot list entries without one of those
|
|
@@ -1150,7 +1250,7 @@ const createContentEntryCrud = params => {
|
|
|
1150
1250
|
plugins: context.plugins,
|
|
1151
1251
|
input: []
|
|
1152
1252
|
});
|
|
1153
|
-
if (fields.includes(fieldId)
|
|
1253
|
+
if (!fields.includes(fieldId)) {
|
|
1154
1254
|
throw new _error.default("Cannot list unique entry field values if the field is not searchable.", "LIST_UNIQUE_ENTRY_VALUES_ERROR", {
|
|
1155
1255
|
fieldId
|
|
1156
1256
|
});
|
|
@@ -1347,9 +1447,9 @@ const createContentEntryCrud = params => {
|
|
|
1347
1447
|
return deleteEntryRevision(model, id);
|
|
1348
1448
|
});
|
|
1349
1449
|
},
|
|
1350
|
-
async deleteEntry(model, entryId) {
|
|
1450
|
+
async deleteEntry(model, entryId, options) {
|
|
1351
1451
|
return context.benchmark.measure("headlessCms.crud.entries.deleteEntry", async () => {
|
|
1352
|
-
return deleteEntry(model, entryId);
|
|
1452
|
+
return deleteEntry(model, entryId, options);
|
|
1353
1453
|
});
|
|
1354
1454
|
},
|
|
1355
1455
|
async deleteMultipleEntries(model, ids) {
|