strapi-plugin-navigation 2.2.4 → 2.2.6
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/README.md +36 -7
- package/admin/src/components/AdditionalFieldInput/index.js +2 -2
- package/admin/src/components/AdditionalFieldInput/types.d.ts +1 -0
- package/admin/src/components/Item/ItemCardHeader/icons.d.ts +1 -1
- package/admin/src/components/Item/ItemCardHeader/icons.js +2 -1
- package/admin/src/components/Item/ItemCardHeader/index.d.ts +1 -0
- package/admin/src/components/Item/ItemCardHeader/index.js +6 -6
- package/admin/src/components/Item/index.js +7 -6
- package/admin/src/components/NavigationItemList/index.d.ts +2 -1
- package/admin/src/components/NavigationItemList/index.js +2 -2
- package/admin/src/hooks/useNavigationManager.d.ts +0 -1
- package/admin/src/index.js +1 -1
- package/admin/src/pages/DataManagerProvider/index.js +14 -1
- package/admin/src/pages/DataManagerProvider/reducer.d.ts +1 -1
- package/admin/src/pages/NoAccessPage/index.d.ts +3 -0
- package/admin/src/pages/NoAccessPage/index.js +31 -0
- package/admin/src/pages/SettingsPage/index.d.ts +0 -1
- package/admin/src/pages/SettingsPage/index.js +9 -0
- package/admin/src/pages/View/components/NavigationHeader/index.d.ts +2 -1
- package/admin/src/pages/View/components/NavigationHeader/index.js +9 -8
- package/admin/src/pages/View/components/NavigationItemForm/index.js +14 -13
- package/admin/src/pages/View/components/NavigationItemForm/types.d.ts +2 -1
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.d.ts +4 -2
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.js +5 -1
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.d.ts +2 -1
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.js +6 -2
- package/admin/src/pages/View/components/NavigationItemPopup/index.d.ts +2 -1
- package/admin/src/pages/View/components/NavigationItemPopup/index.js +4 -3
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/icons.d.ts +0 -1
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/index.d.ts +0 -1
- package/admin/src/pages/View/components/NavigationManager/DeletionConfirm/index.d.ts +0 -1
- package/admin/src/pages/View/components/NavigationManager/ErrorDetails/index.d.ts +0 -1
- package/admin/src/pages/View/components/NavigationManager/Form/index.d.ts +0 -1
- package/admin/src/pages/View/components/NavigationManager/NavigationUpdate/index.d.ts +0 -1
- package/admin/src/pages/View/components/NavigationManager/NewNavigation/index.d.ts +0 -1
- package/admin/src/pages/View/components/NavigationManager/index.d.ts +0 -1
- package/admin/src/pages/View/index.js +26 -19
- package/admin/src/permissions.d.ts +4 -0
- package/admin/src/permissions.js +1 -0
- package/admin/src/translations/en.json +8 -0
- package/package.json +2 -2
- package/permissions.d.ts +1 -0
- package/permissions.js +1 -0
- package/server/bootstrap/index.js +6 -0
- package/server/routes/admin.js +99 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/types/utils.d.ts +5 -0
|
@@ -8,9 +8,13 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const Typography_1 = require("@strapi/design-system/Typography");
|
|
9
9
|
const ModalLayout_1 = require("@strapi/design-system/ModalLayout");
|
|
10
10
|
const utils_1 = require("../../../../utils");
|
|
11
|
-
const NavigationItemPopupHeader = ({ isNewItem }) => {
|
|
11
|
+
const NavigationItemPopupHeader = ({ isNewItem, canUpdate }) => {
|
|
12
|
+
let modalType = 'view';
|
|
13
|
+
if (canUpdate) {
|
|
14
|
+
modalType = isNewItem ? 'new' : 'edit';
|
|
15
|
+
}
|
|
12
16
|
return (react_1.default.createElement(ModalLayout_1.ModalHeader, null,
|
|
13
|
-
react_1.default.createElement(Typography_1.Typography, { variant: "omega", fontWeight: "bold", textColor: "neutral800", as: "h2", id: "asset-dialog-title" }, (0, utils_1.getMessage)(`popup.item.header.${
|
|
17
|
+
react_1.default.createElement(Typography_1.Typography, { variant: "omega", fontWeight: "bold", textColor: "neutral800", as: "h2", id: "asset-dialog-title" }, (0, utils_1.getMessage)(`popup.item.header.${modalType}`))));
|
|
14
18
|
};
|
|
15
19
|
exports.NavigationItemPopupHeader = NavigationItemPopupHeader;
|
|
16
20
|
//# sourceMappingURL=NavigationItemPopupHeader.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default NavigationItemPopUp;
|
|
2
|
-
declare function NavigationItemPopUp({ availableLocale, isOpen, isLoading, data, config, onSubmit, onClose, usedContentTypeItems, getContentTypeItems, usedContentTypesData, locale, readNavigationItemFromLocale, slugify, }: {
|
|
2
|
+
declare function NavigationItemPopUp({ availableLocale, isOpen, isLoading, data, config, onSubmit, onClose, usedContentTypeItems, getContentTypeItems, usedContentTypesData, locale, readNavigationItemFromLocale, slugify, permissions, }: {
|
|
3
3
|
availableLocale: any;
|
|
4
4
|
isOpen: any;
|
|
5
5
|
isLoading: any;
|
|
@@ -13,6 +13,7 @@ declare function NavigationItemPopUp({ availableLocale, isOpen, isLoading, data,
|
|
|
13
13
|
locale: any;
|
|
14
14
|
readNavigationItemFromLocale: any;
|
|
15
15
|
slugify: any;
|
|
16
|
+
permissions?: {} | undefined;
|
|
16
17
|
}): JSX.Element;
|
|
17
18
|
declare namespace NavigationItemPopUp {
|
|
18
19
|
namespace propTypes {
|
|
@@ -34,12 +34,13 @@ const NavigationItemForm_1 = __importDefault(require("../NavigationItemForm"));
|
|
|
34
34
|
const parsers_1 = require("../../utils/parsers");
|
|
35
35
|
const NavigationItemPopupHeader_1 = require("./NavigationItemPopupHeader");
|
|
36
36
|
const utils_1 = require("../../../../utils");
|
|
37
|
-
const NavigationItemPopUp = ({ availableLocale, isOpen, isLoading, data, config = {}, onSubmit, onClose, usedContentTypeItems, getContentTypeItems, usedContentTypesData, locale, readNavigationItemFromLocale, slugify, }) => {
|
|
37
|
+
const NavigationItemPopUp = ({ availableLocale, isOpen, isLoading, data, config = {}, onSubmit, onClose, usedContentTypeItems, getContentTypeItems, usedContentTypesData, locale, readNavigationItemFromLocale, slugify, permissions = {}, }) => {
|
|
38
38
|
const handleOnSubmit = (payload) => {
|
|
39
39
|
onSubmit(payload);
|
|
40
40
|
};
|
|
41
41
|
const { related, relatedType } = data;
|
|
42
42
|
const { availableAudience = [], additionalFields, contentTypes, contentTypeItems, contentTypesNameFields = {}, } = config;
|
|
43
|
+
const { canUpdate } = permissions;
|
|
43
44
|
const appendLabelPublicationStatus = (label = '', item = {}, isCollection = false) => {
|
|
44
45
|
const appendix = (0, parsers_1.isRelationPublished)({
|
|
45
46
|
relatedRef: item,
|
|
@@ -70,8 +71,8 @@ const NavigationItemPopUp = ({ availableLocale, isOpen, isLoading, data, config
|
|
|
70
71
|
const preparedData = (0, react_1.useMemo)(prepareFormData.bind(null, data), [data]);
|
|
71
72
|
const hasViewId = !!data.viewId;
|
|
72
73
|
return (react_1.default.createElement(ModalLayout_1.ModalLayout, { labelledBy: "condition-modal-breadcrumbs", onClose: onClose, isOpen: isOpen },
|
|
73
|
-
react_1.default.createElement(NavigationItemPopupHeader_1.NavigationItemPopupHeader, { isNewItem: !hasViewId }),
|
|
74
|
-
react_1.default.createElement(NavigationItemForm_1.default, { availableLocale: availableLocale, config: config, data: preparedData, isLoading: isLoading, additionalFields: additionalFields, contentTypesNameFields: contentTypesNameFields, availableAudience: availableAudience, contentTypes: contentTypes, contentTypeEntities: contentTypeItems, usedContentTypeEntities: usedContentTypeItems, getContentTypeEntities: getContentTypeItems, usedContentTypesData: usedContentTypesData, onSubmit: handleOnSubmit, onCancel: onClose, appendLabelPublicationStatus: appendLabelPublicationStatus, locale: locale, readNavigationItemFromLocale: readNavigationItemFromLocale, slugify: slugify })));
|
|
74
|
+
react_1.default.createElement(NavigationItemPopupHeader_1.NavigationItemPopupHeader, { isNewItem: !hasViewId, canUpdate: canUpdate }),
|
|
75
|
+
react_1.default.createElement(NavigationItemForm_1.default, { availableLocale: availableLocale, config: config, data: preparedData, isLoading: isLoading, additionalFields: additionalFields, contentTypesNameFields: contentTypesNameFields, availableAudience: availableAudience, contentTypes: contentTypes, contentTypeEntities: contentTypeItems, usedContentTypeEntities: usedContentTypeItems, getContentTypeEntities: getContentTypeItems, usedContentTypesData: usedContentTypesData, onSubmit: handleOnSubmit, onCancel: onClose, appendLabelPublicationStatus: appendLabelPublicationStatus, locale: locale, readNavigationItemFromLocale: readNavigationItemFromLocale, slugify: slugify, permissions: permissions })));
|
|
75
76
|
};
|
|
76
77
|
NavigationItemPopUp.propTypes = {
|
|
77
78
|
data: prop_types_1.default.object.isRequired,
|
|
@@ -51,7 +51,8 @@ const translations_1 = require("../../translations");
|
|
|
51
51
|
const parsers_1 = require("./utils/parsers");
|
|
52
52
|
const View = () => {
|
|
53
53
|
const toggleNotification = (0, helper_plugin_1.useNotification)();
|
|
54
|
-
const { items: availableNavigations, activeItem: activeNavigation, changedActiveItem: changedActiveNavigation, config, navigationItemPopupOpened, isLoading, isLoadingForAdditionalDataToBeSet, isLoadingForSubmit, handleChangeNavigationItemPopupVisibility, handleChangeSelection, handleChangeNavigationData, handleResetNavigationData, handleSubmitNavigation, handleLocalizationSelection, handleI18nCopy, getContentTypeItems, error, availableLocale: allAvailableLocale, readNavigationItemFromLocale, slugify, } = (0, useDataManager_1.default)();
|
|
54
|
+
const { items: availableNavigations, activeItem: activeNavigation, changedActiveItem: changedActiveNavigation, config, navigationItemPopupOpened, isLoading, isLoadingForAdditionalDataToBeSet, isLoadingForSubmit, handleChangeNavigationItemPopupVisibility, handleChangeSelection, handleChangeNavigationData, handleResetNavigationData, handleSubmitNavigation, handleLocalizationSelection, handleI18nCopy, getContentTypeItems, error, availableLocale: allAvailableLocale, readNavigationItemFromLocale, slugify, permissions, } = (0, useDataManager_1.default)();
|
|
55
|
+
const { canAccess, canUpdate } = permissions;
|
|
55
56
|
const availableLocale = (0, react_1.useMemo)(() => allAvailableLocale.filter(locale => locale !== changedActiveNavigation?.localeCode), [changedActiveNavigation, allAvailableLocale]);
|
|
56
57
|
const { i18nCopyItemsModal, i18nCopySourceLocale, setI18nCopyModalOpened, setI18nCopySourceLocale } = (0, useI18nCopyNavigationItemsModal_1.useI18nCopyNavigationItemsModal)((0, react_1.useCallback)((sourceLocale) => {
|
|
57
58
|
const source = activeNavigation?.localizations?.find(({ localeCode }) => localeCode === sourceLocale);
|
|
@@ -80,15 +81,17 @@ const View = () => {
|
|
|
80
81
|
handleChangeNavigationItemPopupVisibility(visible);
|
|
81
82
|
};
|
|
82
83
|
const addNewNavigationItem = (0, react_1.useCallback)((event, viewParentId = null, isMenuAllowedLevel = true, levelPath = '', parentAttachedToMenu = true, structureId = "0") => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
if (canUpdate) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
event.stopPropagation();
|
|
87
|
+
changeNavigationItemPopupState(true, {
|
|
88
|
+
viewParentId,
|
|
89
|
+
isMenuAllowedLevel,
|
|
90
|
+
levelPath,
|
|
91
|
+
parentAttachedToMenu,
|
|
92
|
+
structureId,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
92
95
|
}, [changeNavigationItemPopupState]);
|
|
93
96
|
const usedContentTypesData = (0, react_1.useMemo)(() => changedActiveNavigation ? (0, parsers_1.usedContentTypes)(changedActiveNavigation.items) : [], [changedActiveNavigation]);
|
|
94
97
|
const pullUsedContentTypeItem = (items = []) => items.reduce((prev, curr) => [...prev, curr.relatedRef ? {
|
|
@@ -198,7 +201,9 @@ const View = () => {
|
|
|
198
201
|
tradId: 'header.action.collapseAll',
|
|
199
202
|
margin: '8px',
|
|
200
203
|
},
|
|
201
|
-
|
|
204
|
+
];
|
|
205
|
+
if (canUpdate) {
|
|
206
|
+
endActions.push({
|
|
202
207
|
onClick: addNewNavigationItem,
|
|
203
208
|
startIcon: react_1.default.createElement(Plus_1.default, null),
|
|
204
209
|
disabled: isLoadingForSubmit,
|
|
@@ -206,10 +211,12 @@ const View = () => {
|
|
|
206
211
|
variant: "default",
|
|
207
212
|
tradId: 'header.action.newItem',
|
|
208
213
|
margin: '16px',
|
|
209
|
-
}
|
|
210
|
-
|
|
214
|
+
});
|
|
215
|
+
}
|
|
211
216
|
return (react_1.default.createElement(Main_1.Main, { labelledBy: "title", "aria-busy": isLoadingForSubmit },
|
|
212
|
-
react_1.default.createElement(NavigationHeader_1.default, { structureHasErrors: structureHasErrors, structureHasChanged: structureChanged, availableNavigations: availableNavigations, activeNavigation: activeNavigation, handleChangeSelection: handleChangeNavigationSelection, handleSave: handleSave, handleLocalizationSelection: handleLocalizationSelection, config: config
|
|
217
|
+
react_1.default.createElement(NavigationHeader_1.default, { structureHasErrors: structureHasErrors, structureHasChanged: structureChanged, availableNavigations: availableNavigations, activeNavigation: activeNavigation, handleChangeSelection: handleChangeNavigationSelection, handleSave: handleSave, handleLocalizationSelection: handleLocalizationSelection, config: config, permissions: {
|
|
218
|
+
canAccess, canUpdate
|
|
219
|
+
} }),
|
|
213
220
|
react_1.default.createElement(Layout_1.ContentLayout, null,
|
|
214
221
|
isLoading && react_1.default.createElement(helper_plugin_1.LoadingIndicatorPage, null),
|
|
215
222
|
changedActiveNavigation && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -222,8 +229,8 @@ const View = () => {
|
|
|
222
229
|
react_1.default.createElement(Icon_1.Icon, { as: EmptyDocuments_1.default, width: "160px", height: "88px", color: "" }),
|
|
223
230
|
react_1.default.createElement(Box_1.Box, { padding: 4 },
|
|
224
231
|
react_1.default.createElement(Typography_1.Typography, { variant: "beta", textColor: "neutral600" }, formatMessage((0, translations_1.getTrad)('empty')))),
|
|
225
|
-
react_1.default.createElement(Button_1.Button, { variant: 'secondary', startIcon: react_1.default.createElement(Plus_1.default, null), label: formatMessage((0, translations_1.getTrad)('empty.cta')), onClick: addNewNavigationItem }, formatMessage((0, translations_1.getTrad)('empty.cta'))),
|
|
226
|
-
config.i18nEnabled && availableLocale.length ? (react_1.default.createElement(Flex_1.Flex, { direction: "column", justifyContent: "center" },
|
|
232
|
+
canUpdate && (react_1.default.createElement(Button_1.Button, { variant: 'secondary', startIcon: react_1.default.createElement(Plus_1.default, null), label: formatMessage((0, translations_1.getTrad)('empty.cta')), onClick: addNewNavigationItem }, formatMessage((0, translations_1.getTrad)('empty.cta')))),
|
|
233
|
+
canUpdate && config.i18nEnabled && availableLocale.length ? (react_1.default.createElement(Flex_1.Flex, { direction: "column", justifyContent: "center" },
|
|
227
234
|
react_1.default.createElement(Box_1.Box, { paddingTop: 3, paddingBottom: 3 },
|
|
228
235
|
react_1.default.createElement(Typography_1.Typography, { variant: "beta", textColor: "neutral600" }, formatMessage((0, translations_1.getTrad)('view.i18n.fill.cta')))),
|
|
229
236
|
react_1.default.createElement(Flex_1.Flex, { direction: "row", justifyContent: "center", alignItems: "center" },
|
|
@@ -232,9 +239,9 @@ const View = () => {
|
|
|
232
239
|
react_1.default.createElement(Box_1.Box, { paddingLeft: 1, paddingRight: 1 },
|
|
233
240
|
react_1.default.createElement(Button_1.Button, { variant: "tertiary", onClick: openI18nCopyModalOpened, disabled: !i18nCopySourceLocale, size: "S" }, formatMessage((0, translations_1.getTrad)('view.i18n.fill.cta.button'))))))) : null)),
|
|
234
241
|
!(0, lodash_1.isEmpty)(changedActiveNavigation.items || [])
|
|
235
|
-
&& react_1.default.createElement(NavigationItemList_1.default, { items: isSearchEmpty ? changedActiveNavigation.items || [] : filteredList, onItemLevelAdd: addNewNavigationItem, onItemRemove: handleItemRemove, onItemEdit: handleItemEdit, onItemRestore: handleItemRestore, onItemReOrder: handleItemReOrder, onItemToggleCollapse: handleItemToggleCollapse, displayFlat: !isSearchEmpty, root: true, error: error, allowedLevels: config.allowedLevels, contentTypes: config.contentTypes, isParentAttachedToMenu: true, contentTypesNameFields: config.contentTypesNameFields })))),
|
|
236
|
-
navigationItemPopupOpened && react_1.default.createElement(NavigationItemPopup_1.default, { availableLocale: availableLocale, isLoading: isLoadingForAdditionalDataToBeSet, data: activeNavigationItem, config: config, usedContentTypesData: usedContentTypesData, usedContentTypeItems: usedContentTypeItems, getContentTypeItems: getContentTypeItems, onSubmit: handleSubmitNavigationItem, onClose: onPopUpClose, locale: activeNavigation.localeCode, readNavigationItemFromLocale: readNavigationItemFromLocale, slugify: slugify }),
|
|
237
|
-
i18nCopyItemsModal));
|
|
242
|
+
&& react_1.default.createElement(NavigationItemList_1.default, { items: isSearchEmpty ? changedActiveNavigation.items || [] : filteredList, onItemLevelAdd: addNewNavigationItem, onItemRemove: handleItemRemove, onItemEdit: handleItemEdit, onItemRestore: handleItemRestore, onItemReOrder: handleItemReOrder, onItemToggleCollapse: handleItemToggleCollapse, displayFlat: !isSearchEmpty, root: true, error: error, allowedLevels: config.allowedLevels, contentTypes: config.contentTypes, isParentAttachedToMenu: true, contentTypesNameFields: config.contentTypesNameFields, permissions: permissions })))),
|
|
243
|
+
navigationItemPopupOpened && react_1.default.createElement(NavigationItemPopup_1.default, { availableLocale: availableLocale, isLoading: isLoadingForAdditionalDataToBeSet, data: activeNavigationItem, config: config, usedContentTypesData: usedContentTypesData, usedContentTypeItems: usedContentTypeItems, getContentTypeItems: getContentTypeItems, onSubmit: handleSubmitNavigationItem, onClose: onPopUpClose, locale: activeNavigation.localeCode, readNavigationItemFromLocale: readNavigationItemFromLocale, slugify: slugify, permissions: permissions }),
|
|
244
|
+
canUpdate && i18nCopyItemsModal));
|
|
238
245
|
};
|
|
239
246
|
exports.default = (0, react_1.memo)(View);
|
|
240
247
|
//# sourceMappingURL=index.js.map
|
package/admin/src/permissions.js
CHANGED
|
@@ -7,6 +7,7 @@ const permissions_1 = __importDefault(require("../../permissions"));
|
|
|
7
7
|
const pluginPermissions = {
|
|
8
8
|
access: [{ action: permissions_1.default.render(permissions_1.default.navigation.read), subject: null }],
|
|
9
9
|
update: [{ action: permissions_1.default.render(permissions_1.default.navigation.update), subject: null }],
|
|
10
|
+
settings: [{ action: permissions_1.default.render(permissions_1.default.navigation.settings), subject: null }],
|
|
10
11
|
};
|
|
11
12
|
exports.default = pluginPermissions;
|
|
12
13
|
//# sourceMappingURL=permissions.js.map
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"submit.cta.save": "Save",
|
|
11
11
|
"empty": "Your navigation is empty",
|
|
12
12
|
"empty.cta": "Create first item",
|
|
13
|
+
"popup.item.header.view": "View navigation item",
|
|
13
14
|
"popup.item.header.edit": "Edit navigation item",
|
|
14
15
|
"popup.item.header.new": "New navigation item",
|
|
15
16
|
"popup.item.form.title.label": "Title",
|
|
@@ -83,6 +84,8 @@
|
|
|
83
84
|
"notification.error": "Error while processing request.",
|
|
84
85
|
"notification.error.customField.type": "Unsupported type of custom field",
|
|
85
86
|
"notification.error.item.relation": "Relations provided in some items are incorrect",
|
|
87
|
+
"page.auth.noAccess": "No access",
|
|
88
|
+
"page.auth.not.allowed": "Oops! It seems like You do not have access to this page...",
|
|
86
89
|
"pages.main.search.placeholder": "Type to start searching...",
|
|
87
90
|
"pages.main.header.localization.select.placeholder": "Select locale",
|
|
88
91
|
"pages.settings.general.title": "General settings",
|
|
@@ -185,6 +188,10 @@
|
|
|
185
188
|
"pages.settings.form.customFields.popup.options.description": "Enabling this field will not change already exiting navigation items",
|
|
186
189
|
"pages.settings.form.customFields.popup.multi.label": "Enable multiple options input",
|
|
187
190
|
"components.navigationItem.action.newItem": "Add nested item",
|
|
191
|
+
"components.navigationItem.action.edit": "Edit",
|
|
192
|
+
"components.navigationItem.action.view": "View",
|
|
193
|
+
"components.navigationItem.action.restore": "Restore",
|
|
194
|
+
"components.navigationItem.action.remove": "Remove",
|
|
188
195
|
"components.navigationItem.badge.removed": "Removed",
|
|
189
196
|
"components.navigationItem.badge.draft": "Draft",
|
|
190
197
|
"components.navigationItem.badge.published": "Published",
|
|
@@ -192,6 +199,7 @@
|
|
|
192
199
|
"components.confirmation.dialog.button.confirm": "Confirm",
|
|
193
200
|
"components.confirmation.dialog.description": "Do you want to continue?",
|
|
194
201
|
"components.confirmation.dialog.header": "Confirmation",
|
|
202
|
+
"components.notAccessPage.back": "Back to homepage",
|
|
195
203
|
"view.i18n.fill.cta": "or bootstrap",
|
|
196
204
|
"view.i18n.fill.option": "{locale} locale",
|
|
197
205
|
"view.i18n.fill.cta.button": "copy"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-navigation",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
4
4
|
"description": "Strapi - Navigation plugin",
|
|
5
5
|
"strapi": {
|
|
6
6
|
"name": "navigation",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"scripts": {},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@sindresorhus/slugify": "1.1.0",
|
|
18
|
-
"@strapi/utils": "^4.
|
|
18
|
+
"@strapi/utils": "^4.9.0",
|
|
19
19
|
"lodash": "^4.17.11",
|
|
20
20
|
"pluralize": "^8.0.0",
|
|
21
21
|
"react": "^16.9.0",
|
package/permissions.d.ts
CHANGED
package/permissions.js
CHANGED
|
@@ -28,6 +28,12 @@ const setupPermissions = async ({ strapi }) => {
|
|
|
28
28
|
uid: permissions_1.default.navigation.update,
|
|
29
29
|
pluginName: "navigation",
|
|
30
30
|
},
|
|
31
|
+
{
|
|
32
|
+
section: "plugins",
|
|
33
|
+
displayName: "Settings",
|
|
34
|
+
uid: permissions_1.default.navigation.settings,
|
|
35
|
+
pluginName: "navigation",
|
|
36
|
+
},
|
|
31
37
|
];
|
|
32
38
|
await strapi.admin.services.permission.actionProvider.registerMany(actions);
|
|
33
39
|
};
|
package/server/routes/admin.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const permissions_1 = __importDefault(require("../../permissions"));
|
|
3
7
|
const routes = {
|
|
4
8
|
type: 'admin',
|
|
5
9
|
routes: [
|
|
@@ -7,26 +11,66 @@ const routes = {
|
|
|
7
11
|
method: 'GET',
|
|
8
12
|
path: '/',
|
|
9
13
|
handler: 'admin.get',
|
|
14
|
+
config: {
|
|
15
|
+
policies: [{
|
|
16
|
+
name: "admin::hasPermissions",
|
|
17
|
+
config: {
|
|
18
|
+
actions: [permissions_1.default.render('read')],
|
|
19
|
+
},
|
|
20
|
+
}]
|
|
21
|
+
}
|
|
10
22
|
},
|
|
11
23
|
{
|
|
12
24
|
method: 'POST',
|
|
13
25
|
path: '/',
|
|
14
26
|
handler: 'admin.post',
|
|
27
|
+
config: {
|
|
28
|
+
policies: [{
|
|
29
|
+
name: "admin::hasPermissions",
|
|
30
|
+
config: {
|
|
31
|
+
actions: [permissions_1.default.render('update')],
|
|
32
|
+
},
|
|
33
|
+
}]
|
|
34
|
+
}
|
|
15
35
|
},
|
|
16
36
|
{
|
|
17
37
|
method: 'GET',
|
|
18
38
|
path: '/config',
|
|
19
39
|
handler: 'admin.config',
|
|
40
|
+
config: {
|
|
41
|
+
policies: [{
|
|
42
|
+
name: "admin::hasPermissions",
|
|
43
|
+
config: {
|
|
44
|
+
actions: [permissions_1.default.render('read')],
|
|
45
|
+
},
|
|
46
|
+
}]
|
|
47
|
+
}
|
|
20
48
|
},
|
|
21
49
|
{
|
|
22
50
|
method: 'PUT',
|
|
23
51
|
path: '/config',
|
|
24
52
|
handler: 'admin.updateConfig',
|
|
53
|
+
config: {
|
|
54
|
+
policies: [{
|
|
55
|
+
name: "admin::hasPermissions",
|
|
56
|
+
config: {
|
|
57
|
+
actions: [permissions_1.default.render('settings')],
|
|
58
|
+
},
|
|
59
|
+
}]
|
|
60
|
+
}
|
|
25
61
|
},
|
|
26
62
|
{
|
|
27
63
|
method: 'DELETE',
|
|
28
64
|
path: '/config',
|
|
29
65
|
handler: 'admin.restoreConfig',
|
|
66
|
+
config: {
|
|
67
|
+
policies: [{
|
|
68
|
+
name: "admin::hasPermissions",
|
|
69
|
+
config: {
|
|
70
|
+
actions: [permissions_1.default.render('settings')],
|
|
71
|
+
},
|
|
72
|
+
}]
|
|
73
|
+
}
|
|
30
74
|
},
|
|
31
75
|
{
|
|
32
76
|
method: 'GET',
|
|
@@ -42,16 +86,40 @@ const routes = {
|
|
|
42
86
|
method: 'GET',
|
|
43
87
|
path: '/:id',
|
|
44
88
|
handler: 'admin.getById',
|
|
89
|
+
config: {
|
|
90
|
+
policies: [{
|
|
91
|
+
name: "admin::hasPermissions",
|
|
92
|
+
config: {
|
|
93
|
+
actions: [permissions_1.default.render('read')],
|
|
94
|
+
},
|
|
95
|
+
}]
|
|
96
|
+
}
|
|
45
97
|
},
|
|
46
98
|
{
|
|
47
99
|
method: 'PUT',
|
|
48
100
|
path: '/:id',
|
|
49
101
|
handler: 'admin.put',
|
|
102
|
+
config: {
|
|
103
|
+
policies: [{
|
|
104
|
+
name: "admin::hasPermissions",
|
|
105
|
+
config: {
|
|
106
|
+
actions: [permissions_1.default.render('update')],
|
|
107
|
+
},
|
|
108
|
+
}]
|
|
109
|
+
}
|
|
50
110
|
},
|
|
51
111
|
{
|
|
52
112
|
method: 'DELETE',
|
|
53
113
|
path: '/:id',
|
|
54
114
|
handler: 'admin.delete',
|
|
115
|
+
config: {
|
|
116
|
+
policies: [{
|
|
117
|
+
name: "admin::hasPermissions",
|
|
118
|
+
config: {
|
|
119
|
+
actions: [permissions_1.default.render('update')],
|
|
120
|
+
},
|
|
121
|
+
}]
|
|
122
|
+
}
|
|
55
123
|
},
|
|
56
124
|
{
|
|
57
125
|
method: 'GET',
|
|
@@ -67,24 +135,53 @@ const routes = {
|
|
|
67
135
|
method: 'GET',
|
|
68
136
|
path: '/settings/config',
|
|
69
137
|
handler: 'admin.settingsConfig',
|
|
138
|
+
config: {
|
|
139
|
+
policies: [{
|
|
140
|
+
name: "admin::hasPermissions",
|
|
141
|
+
config: {
|
|
142
|
+
actions: [permissions_1.default.render('settings')],
|
|
143
|
+
},
|
|
144
|
+
}]
|
|
145
|
+
}
|
|
70
146
|
},
|
|
71
147
|
{
|
|
72
148
|
method: 'GET',
|
|
73
149
|
path: '/settings/restart',
|
|
74
150
|
handler: 'admin.settingsRestart',
|
|
75
151
|
config: {
|
|
76
|
-
policies: [
|
|
77
|
-
|
|
152
|
+
policies: [{
|
|
153
|
+
name: "admin::hasPermissions",
|
|
154
|
+
config: {
|
|
155
|
+
actions: [permissions_1.default.render('settings')],
|
|
156
|
+
},
|
|
157
|
+
}]
|
|
158
|
+
}
|
|
78
159
|
},
|
|
79
160
|
{
|
|
80
161
|
method: 'PUT',
|
|
81
162
|
path: '/i18n/copy/:source/:target',
|
|
82
163
|
handler: 'admin.fillFromOtherLocale',
|
|
164
|
+
config: {
|
|
165
|
+
policies: [{
|
|
166
|
+
name: "admin::hasPermissions",
|
|
167
|
+
config: {
|
|
168
|
+
actions: [permissions_1.default.render('update')],
|
|
169
|
+
},
|
|
170
|
+
}]
|
|
171
|
+
}
|
|
83
172
|
},
|
|
84
173
|
{
|
|
85
174
|
method: 'GET',
|
|
86
175
|
path: '/i18n/item/read/:source/:target',
|
|
87
176
|
handler: 'admin.readNavigationItemFromLocale',
|
|
177
|
+
config: {
|
|
178
|
+
policies: [{
|
|
179
|
+
name: "admin::hasPermissions",
|
|
180
|
+
config: {
|
|
181
|
+
actions: [permissions_1.default.render('read')],
|
|
182
|
+
},
|
|
183
|
+
}]
|
|
184
|
+
}
|
|
88
185
|
},
|
|
89
186
|
]
|
|
90
187
|
};
|