@strapi/content-manager 0.0.0-experimental.f31889311d753b5f7d95198ae84d8fce1d156cd6 → 0.0.0-experimental.f6c00790e260ea5a9b6b86abac5fea02b05d569c
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/dist/_chunks/{ComponentConfigurationPage-BWOQWCv2.mjs → ComponentConfigurationPage-CnL10QYC.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BWOQWCv2.mjs.map → ComponentConfigurationPage-CnL10QYC.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-BNxtMIfV.js → ComponentConfigurationPage-G4EIirP8.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BNxtMIfV.js.map → ComponentConfigurationPage-G4EIirP8.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-D340bYlT.js → EditConfigurationPage-B2AA1kVF.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-D340bYlT.js.map → EditConfigurationPage-B2AA1kVF.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-GTp-Ucnw.mjs → EditConfigurationPage-I2kKh9dx.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-GTp-Ucnw.mjs.map → EditConfigurationPage-I2kKh9dx.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-CXkmnAvI.js → EditViewPage-CHgoNwlc.js} +19 -8
- package/dist/_chunks/EditViewPage-CHgoNwlc.js.map +1 -0
- package/dist/_chunks/{EditViewPage-BVMS5hT-.mjs → EditViewPage-zFjJK0s8.mjs} +19 -8
- package/dist/_chunks/EditViewPage-zFjJK0s8.mjs.map +1 -0
- package/dist/_chunks/{Field-Ibi32diw.js → Field-9DePZh-0.js} +120 -92
- package/dist/_chunks/Field-9DePZh-0.js.map +1 -0
- package/dist/_chunks/{Field-nNgv5bpd.mjs → Field-DPAzUS1M.mjs} +118 -90
- package/dist/_chunks/Field-DPAzUS1M.mjs.map +1 -0
- package/dist/_chunks/{Form-DodJsI2A.mjs → Form-CEkENbkF.mjs} +35 -16
- package/dist/_chunks/Form-CEkENbkF.mjs.map +1 -0
- package/dist/_chunks/{Form-Dhnh34ym.js → Form-DPm-KZ1A.js} +35 -16
- package/dist/_chunks/Form-DPm-KZ1A.js.map +1 -0
- package/dist/_chunks/{History-C9auUkDi.js → History-DXSbTWez.js} +4 -4
- package/dist/_chunks/{History-C9auUkDi.js.map → History-DXSbTWez.js.map} +1 -1
- package/dist/_chunks/{History-CKCSQXz_.mjs → History-utls71em.mjs} +4 -4
- package/dist/_chunks/{History-CKCSQXz_.mjs.map → History-utls71em.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-CKEC4ttG.mjs → ListConfigurationPage-CuMXWWqb.mjs} +14 -4
- package/dist/_chunks/ListConfigurationPage-CuMXWWqb.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-Bg4rWUjX.js → ListConfigurationPage-D5C7ACZ_.js} +14 -4
- package/dist/_chunks/ListConfigurationPage-D5C7ACZ_.js.map +1 -0
- package/dist/_chunks/{ListViewPage-B7_WJUjG.mjs → ListViewPage-CdKd-PS_.mjs} +39 -35
- package/dist/_chunks/ListViewPage-CdKd-PS_.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-C2gIeYHG.js → ListViewPage-DfuwH1tt.js} +42 -38
- package/dist/_chunks/ListViewPage-DfuwH1tt.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DqgdUfyn.js → NoContentTypePage-BIxlkWWi.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-DqgdUfyn.js.map → NoContentTypePage-BIxlkWWi.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-Ckem6Ll6.mjs → NoContentTypePage-DkToTT7u.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-Ckem6Ll6.mjs.map → NoContentTypePage-DkToTT7u.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CF29Q-sW.js → NoPermissionsPage-Bu4GWYb-.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CF29Q-sW.js.map → NoPermissionsPage-Bu4GWYb-.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BO-GEjA4.mjs → NoPermissionsPage-DlWi4BAH.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BO-GEjA4.mjs.map → NoPermissionsPage-DlWi4BAH.mjs.map} +1 -1
- package/dist/_chunks/{Relations-C0uC9J4f.js → Relations-CFjTESWQ.js} +4 -4
- package/dist/_chunks/{Relations-C0uC9J4f.js.map → Relations-CFjTESWQ.js.map} +1 -1
- package/dist/_chunks/{Relations-DItV5eow.mjs → Relations-QP5yn9_z.mjs} +4 -4
- package/dist/_chunks/{Relations-DItV5eow.mjs.map → Relations-QP5yn9_z.mjs.map} +1 -1
- package/dist/_chunks/{en-uOUIxfcQ.js → en-BVzUkPxZ.js} +6 -5
- package/dist/_chunks/{en-uOUIxfcQ.js.map → en-BVzUkPxZ.js.map} +1 -1
- package/dist/_chunks/{en-BrCTWlZv.mjs → en-CPTj6CjC.mjs} +6 -5
- package/dist/_chunks/{en-BrCTWlZv.mjs.map → en-CPTj6CjC.mjs.map} +1 -1
- package/dist/_chunks/{index-DrNe6ctw.mjs → index-BHfS6_D5.mjs} +219 -114
- package/dist/_chunks/index-BHfS6_D5.mjs.map +1 -0
- package/dist/_chunks/{index-Dd0nXyJF.js → index-DXiHxy70.js} +200 -95
- package/dist/_chunks/index-DXiHxy70.js.map +1 -0
- package/dist/_chunks/{layout-B3ez7kvr.mjs → layout-DX_52HSH.mjs} +8 -7
- package/dist/_chunks/layout-DX_52HSH.mjs.map +1 -0
- package/dist/_chunks/{layout-CLLtt_5O.js → layout-bE-WUnQ0.js} +8 -7
- package/dist/_chunks/layout-bE-WUnQ0.js.map +1 -0
- package/dist/_chunks/{relations-bRxcNv1q.js → relations-D706vblp.js} +2 -2
- package/dist/_chunks/{relations-bRxcNv1q.js.map → relations-D706vblp.js.map} +1 -1
- package/dist/_chunks/{relations-B0hlsUU_.mjs → relations-SCVAL_aJ.mjs} +2 -2
- package/dist/_chunks/{relations-B0hlsUU_.mjs.map → relations-SCVAL_aJ.mjs.map} +1 -1
- package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +4 -4
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
- package/dist/admin/src/pages/EditView/components/Header.d.ts +10 -11
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +19 -17
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/admin/src/utils/validation.d.ts +4 -1
- package/dist/server/index.js +47 -23
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +47 -23
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +1 -0
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
- package/dist/server/src/services/permission-checker.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +3 -1
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/_chunks/EditViewPage-BVMS5hT-.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-CXkmnAvI.js.map +0 -1
- package/dist/_chunks/Field-Ibi32diw.js.map +0 -1
- package/dist/_chunks/Field-nNgv5bpd.mjs.map +0 -1
- package/dist/_chunks/Form-Dhnh34ym.js.map +0 -1
- package/dist/_chunks/Form-DodJsI2A.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-Bg4rWUjX.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-CKEC4ttG.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-B7_WJUjG.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-C2gIeYHG.js.map +0 -1
- package/dist/_chunks/index-Dd0nXyJF.js.map +0 -1
- package/dist/_chunks/index-DrNe6ctw.mjs.map +0 -1
- package/dist/_chunks/layout-B3ez7kvr.mjs.map +0 -1
- package/dist/_chunks/layout-CLLtt_5O.js.map +0 -1
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
- package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
package/dist/server/index.mjs
CHANGED
@@ -173,7 +173,9 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
173
173
|
return strapi2.db.query("plugin::upload.file").findOne({ where: { id: versionRelationData.id } });
|
174
174
|
};
|
175
175
|
const localesService = strapi2.plugin("i18n")?.service("locales");
|
176
|
+
const i18nContentTypeService = strapi2.plugin("i18n")?.service("content-types");
|
176
177
|
const getDefaultLocale = async () => localesService ? localesService.getDefaultLocale() : null;
|
178
|
+
const isLocalizedContentType = (model) => i18nContentTypeService ? i18nContentTypeService.isLocalizedContentType(model) : false;
|
177
179
|
const getLocaleDictionary = async () => {
|
178
180
|
if (!localesService)
|
179
181
|
return {};
|
@@ -291,6 +293,7 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
291
293
|
getRelationRestoreValue,
|
292
294
|
getMediaRestoreValue,
|
293
295
|
getDefaultLocale,
|
296
|
+
isLocalizedContentType,
|
294
297
|
getLocaleDictionary,
|
295
298
|
getRetentionDays,
|
296
299
|
getVersionStatus,
|
@@ -313,7 +316,13 @@ const createHistoryService = ({ strapi: strapi2 }) => {
|
|
313
316
|
});
|
314
317
|
},
|
315
318
|
async findVersionsPage(params) {
|
316
|
-
const
|
319
|
+
const model = strapi2.getModel(params.query.contentType);
|
320
|
+
const isLocalizedContentType = serviceUtils.isLocalizedContentType(model);
|
321
|
+
const defaultLocale = await serviceUtils.getDefaultLocale();
|
322
|
+
let locale = null;
|
323
|
+
if (isLocalizedContentType) {
|
324
|
+
locale = params.query.locale || defaultLocale;
|
325
|
+
}
|
317
326
|
const [{ results, pagination: pagination2 }, localeDictionary] = await Promise.all([
|
318
327
|
query.findPage({
|
319
328
|
...params.query,
|
@@ -529,11 +538,13 @@ const createLifecyclesService = ({ strapi: strapi2 }) => {
|
|
529
538
|
}
|
530
539
|
const uid2 = context.contentType.uid;
|
531
540
|
const schemas = getSchemas(uid2);
|
541
|
+
const model = strapi2.getModel(uid2);
|
542
|
+
const isLocalizedContentType = serviceUtils.isLocalizedContentType(model);
|
532
543
|
const localeEntries = await strapi2.db.query(uid2).findMany({
|
533
544
|
where: {
|
534
545
|
documentId,
|
535
|
-
locale: { $in: locales },
|
536
|
-
publishedAt: null
|
546
|
+
...isLocalizedContentType ? { locale: { $in: locales } } : {},
|
547
|
+
...contentTypes$1.hasDraftAndPublish(strapi2.contentTypes[uid2]) ? { publishedAt: null } : {}
|
537
548
|
},
|
538
549
|
populate: serviceUtils.getDeepPopulate(
|
539
550
|
uid2,
|
@@ -1193,6 +1204,11 @@ const { createPolicy } = policy;
|
|
1193
1204
|
const hasPermissions = createPolicy({
|
1194
1205
|
name: "plugin::content-manager.hasPermissions",
|
1195
1206
|
validator: validateHasPermissionsInput,
|
1207
|
+
/**
|
1208
|
+
* NOTE: Action aliases are currently not checked at this level (policy).
|
1209
|
+
* This is currently the intended behavior to avoid changing the behavior of API related permissions.
|
1210
|
+
* If you want to add support for it, please create a dedicated RFC with a list of potential side effect this could have.
|
1211
|
+
*/
|
1196
1212
|
handler(ctx, config = {}) {
|
1197
1213
|
const { actions = [], hasAtLeastOne = false } = config;
|
1198
1214
|
const { userAbility } = ctx.state;
|
@@ -1745,7 +1761,7 @@ const collectionTypes = {
|
|
1745
1761
|
permissionChecker2,
|
1746
1762
|
model,
|
1747
1763
|
// @ts-expect-error TODO: fix
|
1748
|
-
{ id, locale, publishedAt: null },
|
1764
|
+
{ documentId: id, locale, publishedAt: null },
|
1749
1765
|
{ availableLocales: true, availableStatus: false }
|
1750
1766
|
);
|
1751
1767
|
ctx.body = { data: {}, meta };
|
@@ -1948,7 +1964,9 @@ const collectionTypes = {
|
|
1948
1964
|
if (permissionChecker2.cannot.unpublish()) {
|
1949
1965
|
return ctx.forbidden();
|
1950
1966
|
}
|
1951
|
-
const { locale } = await getDocumentLocaleAndStatus(body, model
|
1967
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model, {
|
1968
|
+
allowMultipleLocales: true
|
1969
|
+
});
|
1952
1970
|
const entityPromises = documentIds.map(
|
1953
1971
|
(documentId) => documentManager2.findLocales(documentId, model, { locale, isPublished: true })
|
1954
1972
|
);
|
@@ -2299,20 +2317,13 @@ const sanitizeMainField = (model, mainField, userAbility) => {
|
|
2299
2317
|
userAbility,
|
2300
2318
|
model: model.uid
|
2301
2319
|
});
|
2302
|
-
|
2320
|
+
const isMainFieldListable = isListable(model, mainField);
|
2321
|
+
const canReadMainField = permissionChecker2.can.read(null, mainField);
|
2322
|
+
if (!isMainFieldListable || !canReadMainField) {
|
2303
2323
|
return "id";
|
2304
2324
|
}
|
2305
|
-
if (
|
2306
|
-
|
2307
|
-
const userPermissionChecker = getService$1("permission-checker").create({
|
2308
|
-
userAbility,
|
2309
|
-
model: "plugin::users-permissions.user"
|
2310
|
-
});
|
2311
|
-
if (userPermissionChecker.can.read()) {
|
2312
|
-
return "name";
|
2313
|
-
}
|
2314
|
-
}
|
2315
|
-
return "id";
|
2325
|
+
if (model.uid === "plugin::users-permissions.role") {
|
2326
|
+
return "name";
|
2316
2327
|
}
|
2317
2328
|
return mainField;
|
2318
2329
|
};
|
@@ -2570,9 +2581,7 @@ const relations = {
|
|
2570
2581
|
addFiltersClause(permissionQuery, { id: { $in: loadedIds } });
|
2571
2582
|
const sanitizedRes = await loadRelations({ id: entryId }, targetField, {
|
2572
2583
|
...strapi.get("query-params").transform(targetUid, permissionQuery),
|
2573
|
-
ordering: "desc"
|
2574
|
-
page: ctx.request.query.page,
|
2575
|
-
pageSize: ctx.request.query.pageSize
|
2584
|
+
ordering: "desc"
|
2576
2585
|
});
|
2577
2586
|
const relationsUnion = uniqBy("id", concat(sanitizedRes.results, res.results));
|
2578
2587
|
ctx.body = {
|
@@ -3478,12 +3487,27 @@ const createPermissionChecker = (strapi2) => ({ userAbility, model }) => {
|
|
3478
3487
|
ability: userAbility,
|
3479
3488
|
model
|
3480
3489
|
});
|
3481
|
-
const
|
3490
|
+
const { actionProvider } = strapi2.service("admin::permission");
|
3491
|
+
const toSubject = (entity) => {
|
3492
|
+
return entity ? permissionsManager.toSubject(entity, model) : model;
|
3493
|
+
};
|
3482
3494
|
const can = (action, entity, field) => {
|
3483
|
-
|
3495
|
+
const subject = toSubject(entity);
|
3496
|
+
const aliases = actionProvider.unstable_aliases(action, model);
|
3497
|
+
return (
|
3498
|
+
// Test the original action to see if it passes
|
3499
|
+
userAbility.can(action, subject, field) || // Else try every known alias if at least one of them succeed, then the user "can"
|
3500
|
+
aliases.some((alias) => userAbility.can(alias, subject, field))
|
3501
|
+
);
|
3484
3502
|
};
|
3485
3503
|
const cannot = (action, entity, field) => {
|
3486
|
-
|
3504
|
+
const subject = toSubject(entity);
|
3505
|
+
const aliases = actionProvider.unstable_aliases(action, model);
|
3506
|
+
return (
|
3507
|
+
// Test both the original action
|
3508
|
+
userAbility.cannot(action, subject, field) && // and every known alias, if all of them fail (cannot), then the user truly "cannot"
|
3509
|
+
aliases.every((alias) => userAbility.cannot(alias, subject, field))
|
3510
|
+
);
|
3487
3511
|
};
|
3488
3512
|
const sanitizeOutput = (data, { action = ACTIONS.read } = {}) => {
|
3489
3513
|
return permissionsManager.sanitizeOutput(data, { subject: toSubject(data), action });
|