@akemona-org/strapi-admin 3.7.0
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 +22 -0
- package/README.md +41 -0
- package/admin/src/app.js +242 -0
- package/admin/src/assets/icons/icon_auth-permissions.svg +1 -0
- package/admin/src/assets/icons/icon_content-manager.svg +1 -0
- package/admin/src/assets/icons/icon_content-type-builder.svg +1 -0
- package/admin/src/assets/icons/icon_settings-manager.svg +1 -0
- package/admin/src/assets/icons/icon_success.svg +19 -0
- package/admin/src/assets/images/background_empty.svg +1 -0
- package/admin/src/assets/images/background_welcome_homepage.png +0 -0
- package/admin/src/assets/images/banner_strapi-rocket.png +0 -0
- package/admin/src/assets/images/banner_t-shirt.png +0 -0
- package/admin/src/assets/images/bg_hp_tee_shirt.png +0 -0
- package/admin/src/assets/images/logo-strapi.png +0 -0
- package/admin/src/assets/images/logo-t-shirt.svg +1 -0
- package/admin/src/assets/images/logo_github.png +0 -0
- package/admin/src/assets/images/logo_slack.png +0 -0
- package/admin/src/assets/images/logo_stack_overflow.png +0 -0
- package/admin/src/assets/images/logo_strapi.png +0 -0
- package/admin/src/assets/images/oops.png +0 -0
- package/admin/src/assets/images/social_discord.png +0 -0
- package/admin/src/assets/images/social_gh.png +0 -0
- package/admin/src/assets/images/social_reddit.png +0 -0
- package/admin/src/assets/images/social_strapi.png +0 -0
- package/admin/src/assets/images/social_twitter.png +0 -0
- package/admin/src/components/BaselineAlignement/index.js +33 -0
- package/admin/src/components/Bloc/index.js +9 -0
- package/admin/src/components/ContainerFluid/index.js +13 -0
- package/admin/src/components/Fonts/index.js +76 -0
- package/admin/src/components/FormBloc/index.js +60 -0
- package/admin/src/components/FullWidthButton/index.js +15 -0
- package/admin/src/components/GlobalStyle/index.js +175 -0
- package/admin/src/components/Header/index.js +40 -0
- package/admin/src/components/HeaderSearch/HeaderSearch.js +8 -0
- package/admin/src/components/HeaderSearch/index.js +99 -0
- package/admin/src/components/IntlInput/index.js +38 -0
- package/admin/src/components/LeftMenu/LeftMenuFooter/Wrapper.js +51 -0
- package/admin/src/components/LeftMenu/LeftMenuFooter/index.js +44 -0
- package/admin/src/components/LeftMenu/LeftMenuHeader/Wrapper.js +50 -0
- package/admin/src/components/LeftMenu/LeftMenuHeader/index.js +14 -0
- package/admin/src/components/LeftMenu/LeftMenuLink/A.js +39 -0
- package/admin/src/components/LeftMenu/LeftMenuLink/LeftMenuIcon.js +23 -0
- package/admin/src/components/LeftMenu/LeftMenuLink/LeftMenuLinkContent.js +97 -0
- package/admin/src/components/LeftMenu/LeftMenuLink/NotificationCount.js +32 -0
- package/admin/src/components/LeftMenu/LeftMenuLink/index.js +41 -0
- package/admin/src/components/LeftMenu/LeftMenuLinkHeader/Search.js +11 -0
- package/admin/src/components/LeftMenu/LeftMenuLinkHeader/SearchButton.js +11 -0
- package/admin/src/components/LeftMenu/LeftMenuLinkHeader/SearchWrapper.js +11 -0
- package/admin/src/components/LeftMenu/LeftMenuLinkHeader/Title.js +30 -0
- package/admin/src/components/LeftMenu/LeftMenuLinkHeader/index.js +81 -0
- package/admin/src/components/LeftMenu/LeftMenuLinkHeader/messages.json +38 -0
- package/admin/src/components/LeftMenu/LeftMenuLinkSection/EmptyLinksList.js +21 -0
- package/admin/src/components/LeftMenu/LeftMenuLinkSection/EmptyLinksListWrapper.js +9 -0
- package/admin/src/components/LeftMenu/LeftMenuLinkSection/LeftMenuListLink.js +10 -0
- package/admin/src/components/LeftMenu/LeftMenuLinkSection/index.js +84 -0
- package/admin/src/components/LeftMenu/LinksContainer/index.js +31 -0
- package/admin/src/components/LeftMenu/index.js +4 -0
- package/admin/src/components/NavTopRightWrapper/index.js +11 -0
- package/admin/src/components/Notifications/Notification/Li.js +168 -0
- package/admin/src/components/Notifications/Notification/index.js +104 -0
- package/admin/src/components/Notifications/NotificationsContainer/Wrapper.js +17 -0
- package/admin/src/components/Notifications/NotificationsContainer/index.js +56 -0
- package/admin/src/components/Notifications/index.js +2 -0
- package/admin/src/components/PageTitle/index.js +15 -0
- package/admin/src/components/Roles/ButtonWithNumber/NumberCard.js +10 -0
- package/admin/src/components/Roles/ButtonWithNumber/index.js +42 -0
- package/admin/src/components/Roles/CheckboxWithCondition/index.js +41 -0
- package/admin/src/components/Roles/Chevron/index.js +11 -0
- package/admin/src/components/Roles/CollapseLabel/index.js +11 -0
- package/admin/src/components/Roles/ConditionsButton/Wrapper.js +28 -0
- package/admin/src/components/Roles/ConditionsButton/index.js +49 -0
- package/admin/src/components/Roles/ConditionsModal/ActionRow/Wrapper.js +12 -0
- package/admin/src/components/Roles/ConditionsModal/ActionRow/index.js +88 -0
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/ClearIndicator.js +15 -0
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/CustomDropdownIndicator.js +39 -0
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/IndicatorSeparator.js +3 -0
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/SubUl.js +48 -0
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/Ul.js +80 -0
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/UpperFirst.js +6 -0
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/index.js +140 -0
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/utils/constants.js +3 -0
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/MenuList/utils/createCollapsesObject.js +14 -0
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/SingleValue.js +46 -0
- package/admin/src/components/Roles/ConditionsModal/ConditionsSelect/index.js +67 -0
- package/admin/src/components/Roles/ConditionsModal/Separator.js +9 -0
- package/admin/src/components/Roles/ConditionsModal/index.js +150 -0
- package/admin/src/components/Roles/ConditionsModal/utils/createDefaultConditionsForm.js +47 -0
- package/admin/src/components/Roles/ConditionsModal/utils/selectStyle.js +95 -0
- package/admin/src/components/Roles/ContentTypeCollapse/Collapse/Wrapper.js +38 -0
- package/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js +156 -0
- package/admin/src/components/Roles/ContentTypeCollapse/Collapse/utils/constants.js +3 -0
- package/admin/src/components/Roles/ContentTypeCollapse/Collapse/utils/generateCheckboxesActions.js +55 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/Wrapper.js +28 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/index.js +162 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/constants.js +3 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/utils/getRowLabelCheckboxeState.js +59 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/Header/index.js +65 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/Wrapper.js +8 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/index.js +176 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/row.js +37 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/timeline.js +15 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/SubActionRow/utils/constants.js +3 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/Wrapper.js +21 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/index.js +55 -0
- package/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/utils/generateHeadersFromActions.js +12 -0
- package/admin/src/components/Roles/ContentTypeCollapse/Wrapper.js +17 -0
- package/admin/src/components/Roles/ContentTypeCollapse/index.js +72 -0
- package/admin/src/components/Roles/ContentTypeCollapse/utils/activeStyle.js +15 -0
- package/admin/src/components/Roles/ContentTypeCollapse/utils/getAvailableActions.js +10 -0
- package/admin/src/components/Roles/ContentTypeCollapse/utils/index.js +2 -0
- package/admin/src/components/Roles/ContentTypeCollapses/index.js +50 -0
- package/admin/src/components/Roles/ContentTypes/Wrapper.js +13 -0
- package/admin/src/components/Roles/ContentTypes/index.js +39 -0
- package/admin/src/components/Roles/Curve/index.js +35 -0
- package/admin/src/components/Roles/EmptyRole/index.js +31 -0
- package/admin/src/components/Roles/GlobalActions/Wrapper.js +18 -0
- package/admin/src/components/Roles/GlobalActions/index.js +66 -0
- package/admin/src/components/Roles/GlobalActions/utils/constants.js +3 -0
- package/admin/src/components/Roles/GlobalActions/utils/findDisplayedActions.js +4 -0
- package/admin/src/components/Roles/GlobalActions/utils/getRowLabelCheckboxesState.js +38 -0
- package/admin/src/components/Roles/GlobalActions/utils/index.js +2 -0
- package/admin/src/components/Roles/HiddenAction/index.js +9 -0
- package/admin/src/components/Roles/Permissions/README.md +372 -0
- package/admin/src/components/Roles/Permissions/index.js +155 -0
- package/admin/src/components/Roles/Permissions/init.js +41 -0
- package/admin/src/components/Roles/Permissions/reducer.js +177 -0
- package/admin/src/components/Roles/Permissions/utils/createDefaultCTFormFromLayout.js +178 -0
- package/admin/src/components/Roles/Permissions/utils/createDefaultPluginsFormFromLayout.js +49 -0
- package/admin/src/components/Roles/Permissions/utils/findMatchingPermissions.js +4 -0
- package/admin/src/components/Roles/Permissions/utils/formatContentTypesPermissionToAPI.js +122 -0
- package/admin/src/components/Roles/Permissions/utils/formatLayoutForSettingsAndPlugins.js +23 -0
- package/admin/src/components/Roles/Permissions/utils/formatPermissionsToAPI.js +21 -0
- package/admin/src/components/Roles/Permissions/utils/formatSettingsPermissionsToAPI.js +59 -0
- package/admin/src/components/Roles/Permissions/utils/tabLabels.js +24 -0
- package/admin/src/components/Roles/Permissions/utils/updateConditionsToFalse.js +39 -0
- package/admin/src/components/Roles/Permissions/utils/updateValues.js +31 -0
- package/admin/src/components/Roles/PermissionsDataManagerProvider/index.js +26 -0
- package/admin/src/components/Roles/PluginsAndSettings/ListWrapper.js +10 -0
- package/admin/src/components/Roles/PluginsAndSettings/Row/Wrapper.js +28 -0
- package/admin/src/components/Roles/PluginsAndSettings/Row/index.js +82 -0
- package/admin/src/components/Roles/PluginsAndSettings/SubCategory/CheckboxWrapper.js +22 -0
- package/admin/src/components/Roles/PluginsAndSettings/SubCategory/ConditionsButtonWrapper.js +13 -0
- package/admin/src/components/Roles/PluginsAndSettings/SubCategory/Wrapper.js +26 -0
- package/admin/src/components/Roles/PluginsAndSettings/SubCategory/index.js +136 -0
- package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/constants.js +3 -0
- package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/formatActions.js +32 -0
- package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/getConditionsButtonState.js +17 -0
- package/admin/src/components/Roles/PluginsAndSettings/SubCategory/utils/index.js +2 -0
- package/admin/src/components/Roles/PluginsAndSettings/index.js +53 -0
- package/admin/src/components/Roles/RequiredSign/index.js +11 -0
- package/admin/src/components/Roles/RoleForm/NameInput.js +6 -0
- package/admin/src/components/Roles/RoleForm/RoleForm.js +94 -0
- package/admin/src/components/Roles/RoleForm/index.js +2 -0
- package/admin/src/components/Roles/RoleList/RoleDescription.js +9 -0
- package/admin/src/components/Roles/RoleList/RoleListWrapper.js +17 -0
- package/admin/src/components/Roles/RoleList/RoleRow.js +48 -0
- package/admin/src/components/Roles/RoleList/index.js +3 -0
- package/admin/src/components/Roles/RowLabelWithCheckbox/Wrapper.js +29 -0
- package/admin/src/components/Roles/RowLabelWithCheckbox/index.js +76 -0
- package/admin/src/components/Roles/Tabs/Tab.js +22 -0
- package/admin/src/components/Roles/Tabs/TabsWrapper.js +17 -0
- package/admin/src/components/Roles/Tabs/index.js +65 -0
- package/admin/src/components/Roles/index.js +6 -0
- package/admin/src/components/Roles/utils/createArrayOfValues.js +19 -0
- package/admin/src/components/Roles/utils/getCheckboxState.js +19 -0
- package/admin/src/components/Roles/utils/index.js +3 -0
- package/admin/src/components/Roles/utils/removeConditionKeyFromData.js +15 -0
- package/admin/src/components/Settings/Header/index.js +73 -0
- package/admin/src/components/Settings/index.js +2 -0
- package/admin/src/components/SettingsPageTitle/index.js +17 -0
- package/admin/src/components/SizedInput/index.js +25 -0
- package/admin/src/components/UpgradePlanModal/components/Arrow/arrow.png +0 -0
- package/admin/src/components/UpgradePlanModal/components/Arrow/index.js +16 -0
- package/admin/src/components/UpgradePlanModal/components/Download/index.js +13 -0
- package/admin/src/components/UpgradePlanModal/components/Option/Wrapper.js +12 -0
- package/admin/src/components/UpgradePlanModal/components/Option/index.js +18 -0
- package/admin/src/components/UpgradePlanModal/components/Wrapper/balloon.png +0 -0
- package/admin/src/components/UpgradePlanModal/components/Wrapper/index.js +14 -0
- package/admin/src/components/UpgradePlanModal/components/index.js +4 -0
- package/admin/src/components/UpgradePlanModal/index.js +76 -0
- package/admin/src/components/Users/Filter/index.js +41 -0
- package/admin/src/components/Users/FilterPicker/Button.js +14 -0
- package/admin/src/components/Users/FilterPicker/Card/Input.js +35 -0
- package/admin/src/components/Users/FilterPicker/Card/Wrapper.js +8 -0
- package/admin/src/components/Users/FilterPicker/Card/index.js +91 -0
- package/admin/src/components/Users/FilterPicker/Card/init.js +5 -0
- package/admin/src/components/Users/FilterPicker/Card/reducer.js +39 -0
- package/admin/src/components/Users/FilterPicker/Card/utils/form.js +57 -0
- package/admin/src/components/Users/FilterPicker/Card/utils/formatInputValue.js +9 -0
- package/admin/src/components/Users/FilterPicker/Card/utils/getInputValue.js +9 -0
- package/admin/src/components/Users/FilterPicker/Card/utils/index.js +3 -0
- package/admin/src/components/Users/FilterPicker/index.js +35 -0
- package/admin/src/components/Users/Footer/Wrapper.js +7 -0
- package/admin/src/components/Users/Footer/index.js +40 -0
- package/admin/src/components/Users/LinkNotification/Envelope.js +20 -0
- package/admin/src/components/Users/LinkNotification/IconWrapper.js +15 -0
- package/admin/src/components/Users/LinkNotification/Wrapper.js +26 -0
- package/admin/src/components/Users/LinkNotification/index.js +47 -0
- package/admin/src/components/Users/List/ActiveStatus.js +20 -0
- package/admin/src/components/Users/List/Wrapper.js +34 -0
- package/admin/src/components/Users/List/index.js +151 -0
- package/admin/src/components/Users/List/init.js +5 -0
- package/admin/src/components/Users/List/reducer.js +56 -0
- package/admin/src/components/Users/List/utils/checkIfAllEntriesAreSelected.js +3 -0
- package/admin/src/components/Users/List/utils/getSelectedIds.js +19 -0
- package/admin/src/components/Users/List/utils/headers.js +42 -0
- package/admin/src/components/Users/List/utils/index.js +4 -0
- package/admin/src/components/Users/List/utils/updateRows.js +6 -0
- package/admin/src/components/Users/MagicLink/index.js +27 -0
- package/admin/src/components/Users/ModalCreateBody/Wrapper.js +12 -0
- package/admin/src/components/Users/ModalCreateBody/index.js +153 -0
- package/admin/src/components/Users/ModalCreateBody/init.js +5 -0
- package/admin/src/components/Users/ModalCreateBody/reducer.js +27 -0
- package/admin/src/components/Users/ModalCreateBody/utils/form.js +29 -0
- package/admin/src/components/Users/ModalCreateBody/utils/formDataModel.js +8 -0
- package/admin/src/components/Users/ModalCreateBody/utils/roleSettingsForm.js +10 -0
- package/admin/src/components/Users/ModalCreateBody/utils/schema.js +17 -0
- package/admin/src/components/Users/RoleSettingsModalSection/RolesSelectComponent.js +53 -0
- package/admin/src/components/Users/RoleSettingsModalSection/index.js +76 -0
- package/admin/src/components/Users/SelectRoles/ClearIndicator.js +15 -0
- package/admin/src/components/Users/SelectRoles/DropdownIndicator.js +39 -0
- package/admin/src/components/Users/SelectRoles/ErrorMessage.js +10 -0
- package/admin/src/components/Users/SelectRoles/IndicatorSeparator.js +3 -0
- package/admin/src/components/Users/SelectRoles/MultiValueContainer.js +43 -0
- package/admin/src/components/Users/SelectRoles/StyledOption.js +11 -0
- package/admin/src/components/Users/SelectRoles/index.js +68 -0
- package/admin/src/components/Users/SelectRoles/utils/styles.js +99 -0
- package/admin/src/components/Users/SortPicker/Button.js +14 -0
- package/admin/src/components/Users/SortPicker/List.js +46 -0
- package/admin/src/components/Users/SortPicker/ListItem.js +37 -0
- package/admin/src/components/Users/SortPicker/ListWrapper.js +18 -0
- package/admin/src/components/Users/SortPicker/StyledListItem.js +30 -0
- package/admin/src/components/Users/SortPicker/index.js +34 -0
- package/admin/src/components/Users/index.js +8 -0
- package/admin/src/components/Webhooks/EventInput/EventRow.js +66 -0
- package/admin/src/components/Webhooks/EventInput/Wrapper.js +77 -0
- package/admin/src/components/Webhooks/EventInput/index.js +128 -0
- package/admin/src/components/Webhooks/EventInput/utils/formatValue.js +13 -0
- package/admin/src/components/Webhooks/HeadersInput/Wrapper.js +102 -0
- package/admin/src/components/Webhooks/HeadersInput/index.js +143 -0
- package/admin/src/components/Webhooks/HeadersInput/keys.js +39 -0
- package/admin/src/components/Webhooks/HeadersInput/utils/getBorderColor.js +12 -0
- package/admin/src/components/Webhooks/Inputs/Wrapper.js +34 -0
- package/admin/src/components/Webhooks/Inputs/index.js +110 -0
- package/admin/src/components/Webhooks/ListRow/StyledListRow.js +49 -0
- package/admin/src/components/Webhooks/ListRow/index.js +113 -0
- package/admin/src/components/Webhooks/Switch/Toggle.js +30 -0
- package/admin/src/components/Webhooks/Switch/Wrapper.js +67 -0
- package/admin/src/components/Webhooks/Switch/index.js +51 -0
- package/admin/src/components/Webhooks/TriggerContainer/Wrapper.js +64 -0
- package/admin/src/components/Webhooks/TriggerContainer/index.js +103 -0
- package/admin/src/components/Webhooks/index.js +4 -0
- package/admin/src/config.js +13 -0
- package/admin/src/configureStore.js +60 -0
- package/admin/src/containers/Admin/Content.js +30 -0
- package/admin/src/containers/Admin/Logout/components.js +128 -0
- package/admin/src/containers/Admin/Logout/index.js +60 -0
- package/admin/src/containers/Admin/Wrapper.js +27 -0
- package/admin/src/containers/Admin/actions.js +21 -0
- package/admin/src/containers/Admin/constants.js +9 -0
- package/admin/src/containers/Admin/index.js +364 -0
- package/admin/src/containers/Admin/reducer.js +39 -0
- package/admin/src/containers/Admin/selectors.js +22 -0
- package/admin/src/containers/App/actions.js +87 -0
- package/admin/src/containers/App/components.js +15 -0
- package/admin/src/containers/App/constants.js +18 -0
- package/admin/src/containers/App/index.js +157 -0
- package/admin/src/containers/App/reducer.js +86 -0
- package/admin/src/containers/App/selectors.js +38 -0
- package/admin/src/containers/App/styles/website.css +25 -0
- package/admin/src/containers/App/utils/customRoutes.js +3 -0
- package/admin/src/containers/App/utils/defaultRoutes.js +3 -0
- package/admin/src/containers/App/utils/index.js +3 -0
- package/admin/src/containers/App/utils/routes.js +4 -0
- package/admin/src/containers/App/utils/unique-identifier.js +10 -0
- package/admin/src/containers/ApplicationInfosPage/components/Detail/index.js +30 -0
- package/admin/src/containers/ApplicationInfosPage/components/InfoText/index.js +19 -0
- package/admin/src/containers/ApplicationInfosPage/components/Link/components.js +22 -0
- package/admin/src/containers/ApplicationInfosPage/components/Link/index.js +26 -0
- package/admin/src/containers/ApplicationInfosPage/components/Wrapper/index.js +7 -0
- package/admin/src/containers/ApplicationInfosPage/components/index.js +4 -0
- package/admin/src/containers/ApplicationInfosPage/index.js +89 -0
- package/admin/src/containers/AuthPage/components/AuthLink/Link.js +13 -0
- package/admin/src/containers/AuthPage/components/AuthLink/Wrapper.js +8 -0
- package/admin/src/containers/AuthPage/components/AuthLink/index.js +35 -0
- package/admin/src/containers/AuthPage/components/Box/Wrapper.js +13 -0
- package/admin/src/containers/AuthPage/components/Box/index.js +28 -0
- package/admin/src/containers/AuthPage/components/ForgotPassword/index.js +65 -0
- package/admin/src/containers/AuthPage/components/ForgotPasswordSuccess/Envelope.js +20 -0
- package/admin/src/containers/AuthPage/components/ForgotPasswordSuccess/index.js +77 -0
- package/admin/src/containers/AuthPage/components/Input/index.js +32 -0
- package/admin/src/containers/AuthPage/components/Login/BaseLogin.js +84 -0
- package/admin/src/containers/AuthPage/components/Login/index.js +23 -0
- package/admin/src/containers/AuthPage/components/Logo/Img.js +7 -0
- package/admin/src/containers/AuthPage/components/Logo/index.js +7 -0
- package/admin/src/containers/AuthPage/components/Oops/Img.js +7 -0
- package/admin/src/containers/AuthPage/components/Oops/index.js +63 -0
- package/admin/src/containers/AuthPage/components/Register/CustomLabel.js +28 -0
- package/admin/src/containers/AuthPage/components/Register/InputWrapper.js +8 -0
- package/admin/src/containers/AuthPage/components/Register/Span.js +13 -0
- package/admin/src/containers/AuthPage/components/Register/index.js +173 -0
- package/admin/src/containers/AuthPage/components/ResetPassword/index.js +73 -0
- package/admin/src/containers/AuthPage/components/Section/index.js +22 -0
- package/admin/src/containers/AuthPage/index.js +321 -0
- package/admin/src/containers/AuthPage/init.js +5 -0
- package/admin/src/containers/AuthPage/reducer.js +41 -0
- package/admin/src/containers/AuthPage/utils/forms.js +124 -0
- package/admin/src/containers/AuthPage/utils/index.js +2 -0
- package/admin/src/containers/HomePage/BlogPost.js +48 -0
- package/admin/src/containers/HomePage/SocialLink.js +52 -0
- package/admin/src/containers/HomePage/components.js +260 -0
- package/admin/src/containers/HomePage/hooks.js +54 -0
- package/admin/src/containers/HomePage/index.js +239 -0
- package/admin/src/containers/InstalledPluginsPage/ListWrapper.js +7 -0
- package/admin/src/containers/InstalledPluginsPage/Logo.js +36 -0
- package/admin/src/containers/InstalledPluginsPage/Row.js +98 -0
- package/admin/src/containers/InstalledPluginsPage/index.js +73 -0
- package/admin/src/containers/InstalledPluginsPage/utils/generateRows.js +19 -0
- package/admin/src/containers/LanguageProvider/actions.js +16 -0
- package/admin/src/containers/LanguageProvider/constants.js +8 -0
- package/admin/src/containers/LanguageProvider/hooks/useChangeLanguage.js +14 -0
- package/admin/src/containers/LanguageProvider/index.js +49 -0
- package/admin/src/containers/LanguageProvider/reducer.js +52 -0
- package/admin/src/containers/LanguageProvider/selectors.js +25 -0
- package/admin/src/containers/LeftMenu/Loader.js +34 -0
- package/admin/src/containers/LeftMenu/LoaderWrapper.js +13 -0
- package/admin/src/containers/LeftMenu/Wrapper.js +61 -0
- package/admin/src/containers/LeftMenu/actions.js +24 -0
- package/admin/src/containers/LeftMenu/constants.js +4 -0
- package/admin/src/containers/LeftMenu/index.js +101 -0
- package/admin/src/containers/LeftMenu/reducer.js +79 -0
- package/admin/src/containers/LeftMenu/selectors.js +3 -0
- package/admin/src/containers/LeftMenu/useMenuSections.js +62 -0
- package/admin/src/containers/LeftMenu/utils/checkPermissions.js +13 -0
- package/admin/src/containers/LeftMenu/utils/generateModelsLinks.js +61 -0
- package/admin/src/containers/LeftMenu/utils/getCtOrStLinks.js +49 -0
- package/admin/src/containers/LeftMenu/utils/getGeneralLinks.js +42 -0
- package/admin/src/containers/LeftMenu/utils/getPluginSectionLinks.js +17 -0
- package/admin/src/containers/LeftMenu/utils/getSettingsMenuLinksPermissions.js +20 -0
- package/admin/src/containers/LeftMenu/utils/index.js +2 -0
- package/admin/src/containers/LeftMenu/utils/toPluginLinks.js +19 -0
- package/admin/src/containers/LocaleToggle/Wrapper.js +147 -0
- package/admin/src/containers/LocaleToggle/actions.js +19 -0
- package/admin/src/containers/LocaleToggle/constants.js +8 -0
- package/admin/src/containers/LocaleToggle/index.js +84 -0
- package/admin/src/containers/LocaleToggle/reducer.js +25 -0
- package/admin/src/containers/LocaleToggle/selectors.js +25 -0
- package/admin/src/containers/MarketplacePage/MarketplaceBanner/Wrapper.js +29 -0
- package/admin/src/containers/MarketplacePage/MarketplaceBanner/index.js +37 -0
- package/admin/src/containers/MarketplacePage/PluginCard/Wrapper.js +148 -0
- package/admin/src/containers/MarketplacePage/PluginCard/index.js +184 -0
- package/admin/src/containers/MarketplacePage/Wrapper.js +10 -0
- package/admin/src/containers/MarketplacePage/index.js +103 -0
- package/admin/src/containers/NewNotification/Notification/index.js +181 -0
- package/admin/src/containers/NewNotification/Notification/styledComponents.js +66 -0
- package/admin/src/containers/NewNotification/Wrapper.js +19 -0
- package/admin/src/containers/NewNotification/actions.js +9 -0
- package/admin/src/containers/NewNotification/constants.js +2 -0
- package/admin/src/containers/NewNotification/index.js +35 -0
- package/admin/src/containers/NewNotification/reducer.js +49 -0
- package/admin/src/containers/NotFoundPage/index.js +24 -0
- package/admin/src/containers/NotificationProvider/actions.js +37 -0
- package/admin/src/containers/NotificationProvider/constants.js +8 -0
- package/admin/src/containers/NotificationProvider/index.js +45 -0
- package/admin/src/containers/NotificationProvider/reducer.js +48 -0
- package/admin/src/containers/NotificationProvider/selectors.js +27 -0
- package/admin/src/containers/Onboarding/Li.js +150 -0
- package/admin/src/containers/Onboarding/StaticLinks/StyledLink.js +23 -0
- package/admin/src/containers/Onboarding/StaticLinks/index.js +45 -0
- package/admin/src/containers/Onboarding/Video.js +180 -0
- package/admin/src/containers/Onboarding/Wrapper.js +131 -0
- package/admin/src/containers/Onboarding/index.js +134 -0
- package/admin/src/containers/Onboarding/init.js +5 -0
- package/admin/src/containers/Onboarding/reducer.js +62 -0
- package/admin/src/containers/Onboarding/utils/formatAndStoreVideoArray.js +27 -0
- package/admin/src/containers/PermissionsManager/actions.js +25 -0
- package/admin/src/containers/PermissionsManager/constants.js +5 -0
- package/admin/src/containers/PermissionsManager/index.js +49 -0
- package/admin/src/containers/PermissionsManager/reducer.js +66 -0
- package/admin/src/containers/PluginDispatcher/index.js +69 -0
- package/admin/src/containers/PrivateRoute/index.js +39 -0
- package/admin/src/containers/ProfilePage/components.js +9 -0
- package/admin/src/containers/ProfilePage/index.js +170 -0
- package/admin/src/containers/ProfilePage/utils/form.js +36 -0
- package/admin/src/containers/ProfilePage/utils/index.js +2 -0
- package/admin/src/containers/ProfilePage/utils/schema.js +16 -0
- package/admin/src/containers/Roles/CreatePage/index.js +8 -0
- package/admin/src/containers/Roles/EditPage/index.js +172 -0
- package/admin/src/containers/Roles/EditPage/utils/schema.js +8 -0
- package/admin/src/containers/Roles/ListPage/BaselineAlignment.js +8 -0
- package/admin/src/containers/Roles/ListPage/index.js +149 -0
- package/admin/src/containers/Roles/ProtectedEditPage/index.js +31 -0
- package/admin/src/containers/Roles/ProtectedListPage/index.js +12 -0
- package/admin/src/containers/SettingsHeaderSearchContextProvider/index.js +17 -0
- package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/Icon.js +13 -0
- package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/Link.js +25 -0
- package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/Notif.js +17 -0
- package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/Wrapper.js +9 -0
- package/admin/src/containers/SettingsPage/components/ApplicationDetailLink/index.js +26 -0
- package/admin/src/containers/SettingsPage/components/MenuWrapper/index.js +9 -0
- package/admin/src/containers/SettingsPage/components/SettingDispatcher/index.js +27 -0
- package/admin/src/containers/SettingsPage/components/StyledLeftMenu/index.js +13 -0
- package/admin/src/containers/SettingsPage/components/Wrapper/index.js +19 -0
- package/admin/src/containers/SettingsPage/components/index.js +5 -0
- package/admin/src/containers/SettingsPage/index.js +132 -0
- package/admin/src/containers/SettingsPage/utils/createPluginsLinksRoutes.js +23 -0
- package/admin/src/containers/SettingsPage/utils/createRoute.js +8 -0
- package/admin/src/containers/SettingsPage/utils/customRoutes.js +3 -0
- package/admin/src/containers/SettingsPage/utils/defaultRoutes.js +65 -0
- package/admin/src/containers/SettingsPage/utils/findFirstAllowedEndpoint.js +14 -0
- package/admin/src/containers/SettingsPage/utils/getSectionsToDisplay.js +5 -0
- package/admin/src/containers/SettingsPage/utils/index.js +6 -0
- package/admin/src/containers/SettingsPage/utils/makeUniqueRoutes.js +6 -0
- package/admin/src/containers/SettingsPage/utils/routes.js +4 -0
- package/admin/src/containers/Theme/index.js +14 -0
- package/admin/src/containers/Users/EditPage/index.js +137 -0
- package/admin/src/containers/Users/EditPage/utils/form.js +52 -0
- package/admin/src/containers/Users/ListPage/Header.js +78 -0
- package/admin/src/containers/Users/ListPage/ModalForm.js +101 -0
- package/admin/src/containers/Users/ListPage/index.js +289 -0
- package/admin/src/containers/Users/ListPage/init.js +3 -0
- package/admin/src/containers/Users/ListPage/reducer.js +57 -0
- package/admin/src/containers/Users/ListPage/stepper.js +18 -0
- package/admin/src/containers/Users/ListPage/utils/getFilters.js +30 -0
- package/admin/src/containers/Users/ProtectedEditPage/index.js +45 -0
- package/admin/src/containers/Users/ProtectedListPage/index.js +12 -0
- package/admin/src/containers/Webhooks/EditView/Wrapper.js +61 -0
- package/admin/src/containers/Webhooks/EditView/index.js +448 -0
- package/admin/src/containers/Webhooks/EditView/reducer.js +76 -0
- package/admin/src/containers/Webhooks/EditView/utils/fieldsRegex.js +4 -0
- package/admin/src/containers/Webhooks/EditView/utils/form.js +38 -0
- package/admin/src/containers/Webhooks/EditView/utils/formatData.js +26 -0
- package/admin/src/containers/Webhooks/EditView/utils/index.js +3 -0
- package/admin/src/containers/Webhooks/EditView/utils/schema.js +35 -0
- package/admin/src/containers/Webhooks/ListView/Wrapper.js +31 -0
- package/admin/src/containers/Webhooks/ListView/index.js +320 -0
- package/admin/src/containers/Webhooks/ListView/reducer.js +43 -0
- package/admin/src/containers/Webhooks/ProtectedCreateView/index.js +12 -0
- package/admin/src/containers/Webhooks/ProtectedEditView/index.js +12 -0
- package/admin/src/containers/Webhooks/ProtectedListView/index.js +12 -0
- package/admin/src/contexts/MarketPlace/index.js +25 -0
- package/admin/src/contexts/PermisssionsDataManagerContext/index.js +5 -0
- package/admin/src/contexts/SettingsHeaderSearchContext/index.js +5 -0
- package/admin/src/contexts/index.js +2 -0
- package/admin/src/favicon.png +0 -0
- package/admin/src/hooks/index.js +9 -0
- package/admin/src/hooks/useFetchPermissionsLayout/index.js +32 -0
- package/admin/src/hooks/useFetchPermissionsLayout/reducer.js +35 -0
- package/admin/src/hooks/useFetchPluginsFromMarketPlace/index.js +49 -0
- package/admin/src/hooks/useFetchRole/index.js +58 -0
- package/admin/src/hooks/useFetchRole/reducer.js +33 -0
- package/admin/src/hooks/useModels/index.js +47 -0
- package/admin/src/hooks/useModels/reducer.js +45 -0
- package/admin/src/hooks/usePermissionsDataManager/index.js +6 -0
- package/admin/src/hooks/useRolesList/index.js +49 -0
- package/admin/src/hooks/useRolesList/init.js +5 -0
- package/admin/src/hooks/useRolesList/reducer.js +31 -0
- package/admin/src/hooks/useSettingsForm/index.js +136 -0
- package/admin/src/hooks/useSettingsForm/init.js +5 -0
- package/admin/src/hooks/useSettingsForm/reducer.js +60 -0
- package/admin/src/hooks/useSettingsHeaderSearchContext/index.js +6 -0
- package/admin/src/hooks/useSettingsMenu/index.js +56 -0
- package/admin/src/hooks/useSettingsMenu/init.js +49 -0
- package/admin/src/hooks/useSettingsMenu/reducer.js +41 -0
- package/admin/src/hooks/useSettingsMenu/utils/customGlobalLinks.js +1 -0
- package/admin/src/hooks/useSettingsMenu/utils/defaultGlobalLinks.js +14 -0
- package/admin/src/hooks/useSettingsMenu/utils/formatLinks.js +12 -0
- package/admin/src/hooks/useSettingsMenu/utils/globalLinks.js +4 -0
- package/admin/src/i18n.js +17 -0
- package/admin/src/index.html +16 -0
- package/admin/src/permissions/customPermissions.js +1 -0
- package/admin/src/permissions/defaultPermissions.js +60 -0
- package/admin/src/permissions/index.js +7 -0
- package/admin/src/plugins.js +37 -0
- package/admin/src/public-path.js +40 -0
- package/admin/src/reducers.js +28 -0
- package/admin/src/themes/colors.js +51 -0
- package/admin/src/themes/fontWeights.js +8 -0
- package/admin/src/themes/index.js +13 -0
- package/admin/src/themes/sizes.js +31 -0
- package/admin/src/translations/ar.json +146 -0
- package/admin/src/translations/cs.json +183 -0
- package/admin/src/translations/de.json +371 -0
- package/admin/src/translations/dk.json +348 -0
- package/admin/src/translations/en.json +375 -0
- package/admin/src/translations/es.json +338 -0
- package/admin/src/translations/fr.json +232 -0
- package/admin/src/translations/he.json +364 -0
- package/admin/src/translations/id.json +337 -0
- package/admin/src/translations/index.js +86 -0
- package/admin/src/translations/it.json +347 -0
- package/admin/src/translations/ja.json +288 -0
- package/admin/src/translations/ko.json +179 -0
- package/admin/src/translations/ms.json +223 -0
- package/admin/src/translations/nl.json +221 -0
- package/admin/src/translations/no.json +349 -0
- package/admin/src/translations/pl.json +372 -0
- package/admin/src/translations/pt-BR.json +228 -0
- package/admin/src/translations/pt.json +225 -0
- package/admin/src/translations/ru.json +368 -0
- package/admin/src/translations/sk.json +337 -0
- package/admin/src/translations/sv.json +127 -0
- package/admin/src/translations/th.json +332 -0
- package/admin/src/translations/tr.json +371 -0
- package/admin/src/translations/uk.json +223 -0
- package/admin/src/translations/vi.json +179 -0
- package/admin/src/translations/zh-Hans.json +372 -0
- package/admin/src/translations/zh.json +152 -0
- package/admin/src/utils/ComponentApi.js +42 -0
- package/admin/src/utils/FieldApi.js +48 -0
- package/admin/src/utils/MiddlewareApi.js +15 -0
- package/admin/src/utils/Plugin.js +50 -0
- package/admin/src/utils/Strapi.js +28 -0
- package/admin/src/utils/basename.js +3 -0
- package/admin/src/utils/checkFormValidity.js +15 -0
- package/admin/src/utils/checkLatestStrapiVersion.js +11 -0
- package/admin/src/utils/checkStore.js +24 -0
- package/admin/src/utils/constants.js +3 -0
- package/admin/src/utils/formatAPIErrors.js +17 -0
- package/admin/src/utils/getAttributesToDisplay.js +21 -0
- package/admin/src/utils/getExistingActions.js +34 -0
- package/admin/src/utils/getRequestUrl.js +3 -0
- package/admin/src/utils/history.js +6 -0
- package/admin/src/utils/index.js +9 -0
- package/admin/src/utils/injectReducer.js +56 -0
- package/admin/src/utils/injectSaga.js +76 -0
- package/admin/src/utils/reducerInjectors.js +38 -0
- package/admin/src/utils/retrieveGlobalLinks.js +17 -0
- package/admin/src/utils/retrievePluginsMenu.js +17 -0
- package/admin/src/utils/sagaInjectors.js +94 -0
- package/admin/src/utils/sortLinks.js +5 -0
- package/admin/src/validations/users/edit.js +11 -0
- package/admin/src/validations/users/index.js +3 -0
- package/admin/src/validations/users/profile.js +29 -0
- package/admin/src/validations/users/roles.js +11 -0
- package/config/admin-actions.js +122 -0
- package/config/admin-conditions.js +26 -0
- package/config/email-templates/forgot-password.js +25 -0
- package/config/functions/bootstrap.js +67 -0
- package/config/functions/register.js +7 -0
- package/config/layout.js +10 -0
- package/config/migrations/permissions-fields-to-properties.js +104 -0
- package/config/policies/hasPermissions.js +51 -0
- package/config/policies/isAuthenticatedAdmin.js +9 -0
- package/config/routes.json +320 -0
- package/config/settings.js +9 -0
- package/controllers/Webhooks.js +150 -0
- package/controllers/admin.js +101 -0
- package/controllers/authenticated-user.js +56 -0
- package/controllers/authentication.js +181 -0
- package/controllers/formatters/conditions.js +12 -0
- package/controllers/formatters/format-actions-by-sections.js +37 -0
- package/controllers/formatters/index.js +9 -0
- package/controllers/permission.js +51 -0
- package/controllers/role.js +148 -0
- package/controllers/user.js +136 -0
- package/doc/change-the-login-page-logo.md +28 -0
- package/doc/customize-menu.md +17 -0
- package/doc/disable-tracking.md +16 -0
- package/domain/action/index.js +142 -0
- package/domain/action/provider.js +83 -0
- package/domain/condition/index.js +92 -0
- package/domain/condition/provider.js +42 -0
- package/domain/permission/index.js +140 -0
- package/domain/role.js +29 -0
- package/domain/user.js +25 -0
- package/index.html +16 -0
- package/index.js +374 -0
- package/middlewares/auth/defaults.json +5 -0
- package/middlewares/auth/index.js +39 -0
- package/models/Permission.js +7 -0
- package/models/Permission.settings.json +49 -0
- package/models/Role.js +7 -0
- package/models/Role.settings.json +50 -0
- package/models/User.config.js +12 -0
- package/models/User.js +7 -0
- package/models/User.settings.json +88 -0
- package/package.json +129 -0
- package/services/action.js +34 -0
- package/services/auth.js +113 -0
- package/services/condition.js +14 -0
- package/services/constants.js +12 -0
- package/services/content-type.js +208 -0
- package/services/metrics.js +18 -0
- package/services/passport/local-strategy.js +21 -0
- package/services/passport.js +47 -0
- package/services/permission/engine-hooks.js +82 -0
- package/services/permission/engine.js +275 -0
- package/services/permission/permissions-manager/index.js +87 -0
- package/services/permission/permissions-manager/query-builers.js +86 -0
- package/services/permission/queries.js +241 -0
- package/services/permission/sections-builder/builder.js +84 -0
- package/services/permission/sections-builder/handlers.js +156 -0
- package/services/permission/sections-builder/index.js +50 -0
- package/services/permission/sections-builder/section.js +71 -0
- package/services/permission/sections-builder/utils.js +26 -0
- package/services/permission.js +30 -0
- package/services/role.js +470 -0
- package/services/token.js +57 -0
- package/services/user.js +348 -0
- package/utils/index.js +11 -0
- package/validation/action-provider.js +79 -0
- package/validation/authentication/forgot-password.js +20 -0
- package/validation/authentication/index.js +17 -0
- package/validation/authentication/register.js +63 -0
- package/validation/authentication/reset-password.js +21 -0
- package/validation/common-functions/check-fields-are-correctly-nested.js +26 -0
- package/validation/common-functions/check-fields-dont-have-duplicates.js +16 -0
- package/validation/common-functions/index.js +9 -0
- package/validation/common-validators.js +217 -0
- package/validation/permission.js +153 -0
- package/validation/policies/hasPermissions.js +33 -0
- package/validation/role.js +21 -0
- package/validation/user.js +85 -0
- package/webpack.alias.js +64 -0
- package/webpack.config.js +212 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import { get } from 'lodash';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { Flex } from '@buffetjs/core';
|
|
5
|
+
import { useIntl } from 'react-intl';
|
|
6
|
+
import IS_DISABLED from 'ee_else_ce/components/Roles/GlobalActions/utils/constants';
|
|
7
|
+
import { usePermissionsDataManager } from '../../../hooks';
|
|
8
|
+
import CheckboxWithCondition from '../CheckboxWithCondition';
|
|
9
|
+
import { findDisplayedActions, getCheckboxesState } from './utils';
|
|
10
|
+
import Wrapper from './Wrapper';
|
|
11
|
+
|
|
12
|
+
const GlobalActions = ({ actions, isFormDisabled, kind }) => {
|
|
13
|
+
const { formatMessage } = useIntl();
|
|
14
|
+
const { modifiedData, onChangeCollectionTypeGlobalActionCheckbox } = usePermissionsDataManager();
|
|
15
|
+
|
|
16
|
+
const displayedActions = useMemo(() => {
|
|
17
|
+
return findDisplayedActions(actions);
|
|
18
|
+
}, [actions]);
|
|
19
|
+
|
|
20
|
+
const checkboxesState = useMemo(() => {
|
|
21
|
+
return getCheckboxesState(displayedActions, modifiedData[kind]);
|
|
22
|
+
}, [modifiedData, displayedActions, kind]);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Wrapper disabled={isFormDisabled}>
|
|
26
|
+
<Flex>
|
|
27
|
+
{displayedActions.map(({ label, actionId }) => {
|
|
28
|
+
return (
|
|
29
|
+
<CheckboxWithCondition
|
|
30
|
+
key={actionId}
|
|
31
|
+
disabled={isFormDisabled || IS_DISABLED}
|
|
32
|
+
message={formatMessage({
|
|
33
|
+
id: `Settings.roles.form.permissions.${label.toLowerCase()}`,
|
|
34
|
+
defaultMessage: label,
|
|
35
|
+
})}
|
|
36
|
+
onChange={({ target: { value } }) => {
|
|
37
|
+
onChangeCollectionTypeGlobalActionCheckbox(kind, actionId, value);
|
|
38
|
+
}}
|
|
39
|
+
name={actionId}
|
|
40
|
+
value={get(checkboxesState, [actionId, 'hasAllActionsSelected'], false)}
|
|
41
|
+
someChecked={get(checkboxesState, [actionId, 'hasSomeActionsSelected'], false)}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
})}
|
|
45
|
+
</Flex>
|
|
46
|
+
</Wrapper>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
GlobalActions.defaultProps = {
|
|
51
|
+
actions: [],
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
GlobalActions.propTypes = {
|
|
55
|
+
actions: PropTypes.arrayOf(
|
|
56
|
+
PropTypes.shape({
|
|
57
|
+
label: PropTypes.string.isRequired,
|
|
58
|
+
actionId: PropTypes.string.isRequired,
|
|
59
|
+
subjects: PropTypes.array.isRequired,
|
|
60
|
+
})
|
|
61
|
+
),
|
|
62
|
+
isFormDisabled: PropTypes.bool.isRequired,
|
|
63
|
+
kind: PropTypes.string.isRequired,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default memo(GlobalActions);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { get } from 'lodash';
|
|
2
|
+
import { getCheckboxState, removeConditionKeyFromData } from '../../utils';
|
|
3
|
+
|
|
4
|
+
const getActionsIds = array => array.map(({ actionId }) => actionId);
|
|
5
|
+
|
|
6
|
+
const getRelatedActionIdData = (actionIdArray, dataObj) => {
|
|
7
|
+
return actionIdArray.reduce((acc, actionId) => {
|
|
8
|
+
Object.keys(dataObj).forEach(ctUid => {
|
|
9
|
+
const actionIdData = get(dataObj, [ctUid, actionId], {});
|
|
10
|
+
|
|
11
|
+
const actionIdState = { [ctUid]: removeConditionKeyFromData(actionIdData) };
|
|
12
|
+
|
|
13
|
+
if (!acc[actionId]) {
|
|
14
|
+
acc[actionId] = actionIdState;
|
|
15
|
+
} else {
|
|
16
|
+
acc[actionId] = { ...acc[actionId], ...actionIdState };
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return acc;
|
|
21
|
+
}, {});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const getCheckboxesState = (properties, modifiedData) => {
|
|
25
|
+
const actionsIds = getActionsIds(properties);
|
|
26
|
+
const relatedActionsData = getRelatedActionIdData(actionsIds, modifiedData);
|
|
27
|
+
|
|
28
|
+
const checkboxesState = Object.keys(relatedActionsData).reduce((acc, current) => {
|
|
29
|
+
acc[current] = getCheckboxState(relatedActionsData[current]);
|
|
30
|
+
|
|
31
|
+
return acc;
|
|
32
|
+
}, {});
|
|
33
|
+
|
|
34
|
+
return checkboxesState;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default getCheckboxesState;
|
|
38
|
+
export { getActionsIds, getRelatedActionIdData };
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
# Technical documentation
|
|
2
|
+
|
|
3
|
+
This documentation covers how the `<Permissions />` component works.
|
|
4
|
+
This component is in charge of managing the permissions of the admin panel, it has 4 children, one child for each tab.
|
|
5
|
+
The displayed tabs are:
|
|
6
|
+
|
|
7
|
+
- Collection Types: this tab allows to set permissions of the CRUD actions for the application's collection types.
|
|
8
|
+
- Single Types: similarly, this tab allows to set permissions for the single types.
|
|
9
|
+
- Plugins: this tabs allows to define permissions for the installed plugins of the application.
|
|
10
|
+
- Settings: this tabs allows to define permissions for the plugins settings. The settings are found in the settings view which is accessible by clicking on the link from the main left menu.
|
|
11
|
+
|
|
12
|
+
The collection types & single types tabs uses the same component: `<ContentTypes>` similarly, the Plugins & Settings tabs use the `<Plugins>` component.
|
|
13
|
+
|
|
14
|
+
The UI uses the layout received from the back-end in order to build the UI.
|
|
15
|
+
|
|
16
|
+
> Endpoint: `/admin/permissions`.
|
|
17
|
+
|
|
18
|
+
## Layout shape
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const layout = {
|
|
22
|
+
conditions: [{ id: 'string', displayName: 'string', category: 'string'}], // Array of conditions that can be applied on a permission
|
|
23
|
+
sections: {
|
|
24
|
+
plugins: [
|
|
25
|
+
{ displayName: 'string', action: 'string', subCategory: 'string', plugin: 'string'}
|
|
26
|
+
], // For the content types permissions, actions can be CRUD + publish but for plugins and settings sections, it depends. Settings/plugins can have custom actions.
|
|
27
|
+
settings: [], // Same shape as the plugins
|
|
28
|
+
collectionTypes: {
|
|
29
|
+
subjects: [ // Array of subjects, a subject is a collection type
|
|
30
|
+
{
|
|
31
|
+
uid: 'string', // Collection type uid,
|
|
32
|
+
label: 'string', // Collection type label,
|
|
33
|
+
properties: [
|
|
34
|
+
{
|
|
35
|
+
label: 'string', // Property label ex: Fields. By default a collection type always has the fields property, depending on the installed plugins a property can also be Locales.
|
|
36
|
+
value: 'string', // Value of the property ex: fields. (Checkout the examples below.)
|
|
37
|
+
children: [ // This corresponds to the fields that will be displayed
|
|
38
|
+
{
|
|
39
|
+
label: 'string',
|
|
40
|
+
value: 'string',
|
|
41
|
+
required: 'boolean', // This key is optional,
|
|
42
|
+
children: [], // This key is optional, if it exists it means that a field has nested fields, the naming can interfere with the React's programmatic API, so in the codebase the key is renamed to `childrenForm`.
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
actions: [ // Array of actions they refer to CRUD methods that are available on a content type
|
|
50
|
+
{
|
|
51
|
+
label: 'string', // Label of the action ex: Create,
|
|
52
|
+
actionId: 'string', // id of the action ex: content-manager.explorer.create
|
|
53
|
+
subjects: [<string>], // Array of subjects (collection type uid) on which the action can be applied
|
|
54
|
+
applyToProperties: [<string>] // Array of properties (ex: fields or locales) on which an action can be applied
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Concepts
|
|
65
|
+
|
|
66
|
+
- Checkbox: has only 1 `checked=true` or `checked=false`.
|
|
67
|
+
|
|
68
|
+
- Parent checkbox: A **parent checkbox** is a checkbox which the state value depends on the state of its children ones. It means that the value cannot directly be accessed from the `modifiedData` object.
|
|
69
|
+
Such checkbox has 2 props in order to indicate the user if all the children checkboxes are checked or some of them are checked:
|
|
70
|
+
- someChecked: `true` or `false`,
|
|
71
|
+
- checked: `true` of `false`
|
|
72
|
+
> Both states are coupled: if `someChecked=true` then `checked=false`.
|
|
73
|
+
> In terms of user's interaction when cliking a parent checkbox it will toggle the value of its children.
|
|
74
|
+
|
|
75
|
+
Ex: given the following data:
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
const modifiedData = {
|
|
79
|
+
address: {
|
|
80
|
+
create: {
|
|
81
|
+
fields: { f1: true, f2: true,}
|
|
82
|
+
locales: { en: false, fr: false}
|
|
83
|
+
},
|
|
84
|
+
update: {
|
|
85
|
+
enabled: true,
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
From the `modifiedData` object, 4 parent checkboxes can be identified:
|
|
92
|
+
|
|
93
|
+
1. `address` which value depends on the values of `address.create` & `address.update` here the state will be: `someChecked=true`
|
|
94
|
+
2. `create` which value depends on the values of `address.create.fields` & `address.create.locales` here the state will be: `someChecked=true, checked=true`
|
|
95
|
+
3. `fields` which value depends on the values of `address.create.fields.f1` & `address.create.fields.f2` here the state will be: `checked=true`
|
|
96
|
+
4. `locales` which value depends on the values of `address.create.locales.en` & `address.create.locales.fr` here the state will be `checked=false, someChecked=false`
|
|
97
|
+
|
|
98
|
+
> `address.update` is not a parent checkbox since we can access its value directly `address.update.enabled`
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Components architecture
|
|
103
|
+
|
|
104
|
+
### `<Permissions />` architecture
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
<PermissionsDataManagerProvider>
|
|
108
|
+
<Tabs>
|
|
109
|
+
<ContentTypes /> // Used with the `layout.sections.collectionTypes` data, the keys are hardcoded
|
|
110
|
+
in the DOM directly
|
|
111
|
+
<ContentTypes /> // Used with the `layout.sections.singleTypes` data
|
|
112
|
+
<PluginsAndSettings /> // Used with the `layout.sections.settings` data
|
|
113
|
+
<PluginsAndSettings /> // Used with the `layout.sections.plugins` data
|
|
114
|
+
</Tabs>
|
|
115
|
+
</PermissionsDataManagerProvider>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Below, is the architecture of the `<Permissions />` component:
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
<ContentTypes>
|
|
122
|
+
<GlobalActions /> // Component in charge of displaying the global action checkboxes (parent
|
|
123
|
+
checkboxes), they are used to toggle all the checkboxes of the associated column
|
|
124
|
+
<ContentTypeCollapses>
|
|
125
|
+
{' '}
|
|
126
|
+
// Wrapper or the collapse and the matrix
|
|
127
|
+
<ContentTypeCollapse>
|
|
128
|
+
<Collapse /> // Main row of a content type => Displays the main actions of a content type
|
|
129
|
+
(parent checkboxes)
|
|
130
|
+
<CollapsePropertyMatrix>
|
|
131
|
+
{' '}
|
|
132
|
+
// Matrix of the actions subject property
|
|
133
|
+
<Header /> // Row that displays the actions labels inside a property (ex: create, read,
|
|
134
|
+
update)
|
|
135
|
+
<ActionRow>
|
|
136
|
+
{' '}
|
|
137
|
+
// Displays a subject's property values
|
|
138
|
+
<SubActionRow /> // Recursive component if a property has a children key, the component
|
|
139
|
+
will return itself
|
|
140
|
+
</ActionRow>
|
|
141
|
+
</CollapsePropertyMatrix>
|
|
142
|
+
</ContentTypeCollapse>
|
|
143
|
+
</ContentTypeCollapses>
|
|
144
|
+
</ContentTypes>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Building the matrix layout
|
|
148
|
+
|
|
149
|
+
In order to build the layout, the components use the `sections.collectionTypes.subjects` value received from the API.
|
|
150
|
+
|
|
151
|
+
#### Retrieving the actions to display in the `<GlobalActions />`
|
|
152
|
+
|
|
153
|
+
This section covers the logic defined in order to display a global checkbox like the `create` one. Each global action, is considered as a parent checkbox since their purpose is to check or uncheck all the checkboxes that are located below them.
|
|
154
|
+
|
|
155
|
+
Pratical example:
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
// layout.sections.collectionTypes.actions
|
|
159
|
+
const actions = [
|
|
160
|
+
{
|
|
161
|
+
label: 'Create',
|
|
162
|
+
actionId: 'content-manager.explorer.A1',
|
|
163
|
+
subjects: ['address', 'restaurant'],
|
|
164
|
+
applyToProperties: ['fields', 'locales',],
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
label: 'Read',
|
|
168
|
+
actionId: 'content-manager.explorer.read',
|
|
169
|
+
subjects: ['address'],
|
|
170
|
+
applyToProperties: ['fields'],
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
label: 'Delete',
|
|
174
|
+
actionId: 'content-manager.explorer.delete',
|
|
175
|
+
subjects: ['restaurant'],
|
|
176
|
+
}
|
|
177
|
+
{
|
|
178
|
+
label: 'Publish',
|
|
179
|
+
actionId: 'content-manager.explorer.publish',
|
|
180
|
+
subjects: [],
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
The UI only displays CRUD actions that can be applied to a subject (a content type). The `subjects` array of the `Publish` action is empty, so this action is not applied to any subject. Consequently, the UI only displays the `create`, `read` and `delete` actions.
|
|
186
|
+
|
|
187
|
+
#### Building the content type's matrix
|
|
188
|
+
|
|
189
|
+
Using the actions defined above and the following data:
|
|
190
|
+
|
|
191
|
+
```js
|
|
192
|
+
// layout.sections.collectionTypes.subjects
|
|
193
|
+
const subjects = [
|
|
194
|
+
{
|
|
195
|
+
uid: 'address',
|
|
196
|
+
label: 'Address'
|
|
197
|
+
properties: {
|
|
198
|
+
{
|
|
199
|
+
label: 'Fields',
|
|
200
|
+
value: 'fields',
|
|
201
|
+
children: [
|
|
202
|
+
{value: 'f1', label: 'F1'},
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
uid: 'restaurant',
|
|
209
|
+
label: 'Restaurant',
|
|
210
|
+
properties: [
|
|
211
|
+
{
|
|
212
|
+
label: 'Fields',
|
|
213
|
+
value: 'fields',
|
|
214
|
+
children: [
|
|
215
|
+
{
|
|
216
|
+
label: 'F1',
|
|
217
|
+
value: 'f1',
|
|
218
|
+
children: [
|
|
219
|
+
{
|
|
220
|
+
label: 'F11',
|
|
221
|
+
value: 'f11',
|
|
222
|
+
children: [
|
|
223
|
+
{ label: 'F111', value: 'f111' }
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
{ label: 'F2', value: 'f2' }
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
label: 'Locales',
|
|
233
|
+
value: 'locales',
|
|
234
|
+
children: [{ label: 'en', value: 'en'}, { label: 'fr', value: 'fr' }]
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
With this layout the ui will look like the following: (`[]` represents a checkbox )
|
|
242
|
+
|
|
243
|
+
| | [] Create | [] Read | [] Delete | `<GlobalActions />` | Parent Wrapper: `<ContentTypes />` |
|
|
244
|
+
| ------------- | ---------- | -------- | --------- | ------------------- | -------------------------------------------- |
|
|
245
|
+
| [] Address | [] | [] | | `<Collapse />` | Parent Wrapper: `<ContentTypeCollapse />` |
|
|
246
|
+
| **Fields** | **Create** | **Read** | | `<Header />` | Parent Wrapper: `<CollapsePropertyMatrix />` |
|
|
247
|
+
| [] F1 | [] | [] | | `<ActionRow />` | Parent Wrapper: `<CollapsePropertyMatrix />` |
|
|
248
|
+
| | | | | | |
|
|
249
|
+
| [] Restaurant | [] Create | [] Read | [] Delete | `<Collapse />` | Parent Wrapper: `<CollapsePropertyMatrix />` |
|
|
250
|
+
| **Fields** | **Create** | | | `<Header />` | Parent Wrapper: `<CollapsePropertyMatrix />` |
|
|
251
|
+
| [] F1 | [] | | | `<ActionRow />` | Parent Wrapper: `<CollapsePropertyMatrix />` |
|
|
252
|
+
| F1.F11 | [] | | | `<SubActionRow />` | Parent Wrapper: `<ActionRow />` |
|
|
253
|
+
| F1.F11.F111 | [] | | | `<SubActionRow />` | Parent Wrapper: `<SubActionRow />` |
|
|
254
|
+
| [ ] F2 | [] | | | `<ActionRow />` | Parent Wrapper: `<CollapsePropertyMatrix />` |
|
|
255
|
+
| **Locales** | **Create** | **Read** | | `<Header />` | Parent Wrapper: `<CollapsePropertyMatrix />` |
|
|
256
|
+
| [ ] EN | [] | [] | | `<ActionRow />` | Parent Wrapper: `<CollapsePropertyMatrix />` |
|
|
257
|
+
| [ ] FR | [] | [] | | `<ActionRow />` | Parent Wrapper: `<CollapsePropertyMatrix />` |
|
|
258
|
+
|
|
259
|
+
#### Shape of the `modifiedData.collectionTypes` object:
|
|
260
|
+
|
|
261
|
+
In order to easily know the state of a checkbox, the `modifiedData` is built using the `layout.sections.collectionTypes` to generate the following shape:
|
|
262
|
+
|
|
263
|
+
```js
|
|
264
|
+
const conditions = [
|
|
265
|
+
{
|
|
266
|
+
id: 'admin::is-creator',
|
|
267
|
+
displayName: 'Is creator',
|
|
268
|
+
category: 'default',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: 'admin::has-same-role-as-creator',
|
|
272
|
+
displayName: 'Has same role as creator',
|
|
273
|
+
category: 'default',
|
|
274
|
+
},
|
|
275
|
+
];
|
|
276
|
+
const collectionTypesDefaultForm = createDefaultCTFormFromLayout(layout.sections.collectionTypes, action, conditions)
|
|
277
|
+
// createDefaultCTFormFromLayout returns an object with all the values set to false.
|
|
278
|
+
// Using the data from above it will return
|
|
279
|
+
|
|
280
|
+
console.log(collectionTypesDefaultForm)
|
|
281
|
+
|
|
282
|
+
{
|
|
283
|
+
address: {
|
|
284
|
+
'content-manager.explorer.create': {
|
|
285
|
+
fields: {
|
|
286
|
+
f1: false,
|
|
287
|
+
},
|
|
288
|
+
conditions: {
|
|
289
|
+
'admin::is-creator': false,
|
|
290
|
+
'admin::has-same-role-as-creator': false
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
'content-manager.explorer.read': {
|
|
294
|
+
fields: {
|
|
295
|
+
f1: false,
|
|
296
|
+
},
|
|
297
|
+
conditions: {
|
|
298
|
+
'admin::is-creator': false,
|
|
299
|
+
'admin::has-same-role-as-creator': false
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
restaurant: {
|
|
304
|
+
'content-manager.explorer.create': {
|
|
305
|
+
fields: {
|
|
306
|
+
f1: {
|
|
307
|
+
f11: {
|
|
308
|
+
f111: false
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
f2: false
|
|
312
|
+
},
|
|
313
|
+
locales: { en: false, fr: false},
|
|
314
|
+
conditions: {
|
|
315
|
+
'admin::is-creator': false,
|
|
316
|
+
'admin::has-same-role-as-creator': false
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
'content-manager.explorer.delete: {
|
|
320
|
+
enabled: false,
|
|
321
|
+
conditions: {
|
|
322
|
+
'admin::is-creator': false,
|
|
323
|
+
'admin::has-same-role-as-creator': false
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
#### Getting the state of a checkbox using the `modifiedData` object
|
|
331
|
+
|
|
332
|
+
Examples:
|
|
333
|
+
|
|
334
|
+
- The `create` checkbox located in the `<GlobalActions />` component is a **parent checkbox** therefore, it's value depends on its children ones. Since, this checkbox is related the `content-manager.explorer.create` action we need to know the values of:
|
|
335
|
+
- `address['content-manager.explorer.create'].fields.f1`
|
|
336
|
+
- `restaurant['content-manager.explorer.create'].fields.f1.f11.f111`
|
|
337
|
+
- `restaurant['content-manager.explorer.create'].fields.f2`
|
|
338
|
+
- `restaurant['content-manager.explorer.create'].locales.en`
|
|
339
|
+
- `restaurant['content-manager.explorer.create'].locales.fr`
|
|
340
|
+
|
|
341
|
+
> The `conditions` key is not a property of an action so the value of `create` does not depend on it
|
|
342
|
+
|
|
343
|
+
A way to dynamically retrieve the state of the `create` checkbox, is to create the following object:
|
|
344
|
+
|
|
345
|
+
```js
|
|
346
|
+
const objectToRetrieveTheStateOfTheCreateCheckbox = {
|
|
347
|
+
address: {
|
|
348
|
+
fields: { f1: false },
|
|
349
|
+
},
|
|
350
|
+
restaurant: {
|
|
351
|
+
fields: {
|
|
352
|
+
f1: { f11: { f111: false } },
|
|
353
|
+
f2: false,
|
|
354
|
+
},
|
|
355
|
+
locales: { en: false, fr: false },
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
In order to know is all the properties are `false` or if some of them are `true`, an array of `Boolean` values could be created from the object.
|
|
361
|
+
|
|
362
|
+
```js
|
|
363
|
+
const arrayOfPermissionLeafsBooleanValues = [
|
|
364
|
+
false, // address.fields.f1
|
|
365
|
+
false, // restaurant.field.f1.f11.f111,
|
|
366
|
+
false, // restaurant.fields.f2,
|
|
367
|
+
false, // restaurant.locales.en
|
|
368
|
+
false, // restaurant.locales.fr
|
|
369
|
+
];
|
|
370
|
+
|
|
371
|
+
const checkboxCreateState = { someChecked: false, allChecked: false };
|
|
372
|
+
```
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import React, { forwardRef, memo, useCallback, useImperativeHandle, useReducer } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { difference } from 'strapi-helper-plugin';
|
|
4
|
+
import { has, isEmpty } from 'lodash';
|
|
5
|
+
import Tabs from '../Tabs';
|
|
6
|
+
import PermissionsDataManagerProvider from '../PermissionsDataManagerProvider';
|
|
7
|
+
import ContentTypes from '../ContentTypes';
|
|
8
|
+
import PluginsAndSettings from '../PluginsAndSettings';
|
|
9
|
+
import TAB_LABELS from './utils/tabLabels';
|
|
10
|
+
import formatPermissionsToAPI from './utils/formatPermissionsToAPI';
|
|
11
|
+
import init from './init';
|
|
12
|
+
import reducer, { initialState } from './reducer';
|
|
13
|
+
|
|
14
|
+
const Permissions = forwardRef(({ layout, isFormDisabled, permissions }, ref) => {
|
|
15
|
+
const [{ initialData, layouts, modifiedData }, dispatch] = useReducer(reducer, initialState, () =>
|
|
16
|
+
init(layout, permissions)
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
useImperativeHandle(ref, () => {
|
|
20
|
+
return {
|
|
21
|
+
getPermissions: () => {
|
|
22
|
+
const collectionTypesDiff = difference(
|
|
23
|
+
initialData.collectionTypes,
|
|
24
|
+
modifiedData.collectionTypes
|
|
25
|
+
);
|
|
26
|
+
const singleTypesDiff = difference(initialData.singleTypes, modifiedData.singleTypes);
|
|
27
|
+
|
|
28
|
+
const contentTypesDiff = { ...collectionTypesDiff, ...singleTypesDiff };
|
|
29
|
+
|
|
30
|
+
let didUpdateConditions;
|
|
31
|
+
|
|
32
|
+
if (isEmpty(contentTypesDiff)) {
|
|
33
|
+
didUpdateConditions = false;
|
|
34
|
+
} else {
|
|
35
|
+
didUpdateConditions = Object.values(contentTypesDiff).some(permission => {
|
|
36
|
+
return Object.values(permission).some(permissionValue =>
|
|
37
|
+
has(permissionValue, 'conditions')
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return { permissionsToSend: formatPermissionsToAPI(modifiedData), didUpdateConditions };
|
|
43
|
+
},
|
|
44
|
+
resetForm: () => {
|
|
45
|
+
dispatch({ type: 'RESET_FORM' });
|
|
46
|
+
},
|
|
47
|
+
setFormAfterSubmit: () => {
|
|
48
|
+
dispatch({ type: 'SET_FORM_AFTER_SUBMIT' });
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const handleChangeCollectionTypeLeftActionRowCheckbox = (
|
|
54
|
+
pathToCollectionType,
|
|
55
|
+
propertyName,
|
|
56
|
+
rowName,
|
|
57
|
+
value
|
|
58
|
+
) => {
|
|
59
|
+
dispatch({
|
|
60
|
+
type: 'ON_CHANGE_COLLECTION_TYPE_ROW_LEFT_CHECKBOX',
|
|
61
|
+
pathToCollectionType,
|
|
62
|
+
propertyName,
|
|
63
|
+
rowName,
|
|
64
|
+
value,
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const handleChangeCollectionTypeGlobalActionCheckbox = (collectionTypeKind, actionId, value) => {
|
|
69
|
+
dispatch({
|
|
70
|
+
type: 'ON_CHANGE_COLLECTION_TYPE_GLOBAL_ACTION_CHECKBOX',
|
|
71
|
+
collectionTypeKind,
|
|
72
|
+
actionId,
|
|
73
|
+
value,
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const handleChangeConditions = conditions => {
|
|
78
|
+
dispatch({ type: 'ON_CHANGE_CONDITIONS', conditions });
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const handleChangeSimpleCheckbox = useCallback(({ target: { name, value } }) => {
|
|
82
|
+
dispatch({
|
|
83
|
+
type: 'ON_CHANGE_SIMPLE_CHECKBOX',
|
|
84
|
+
keys: name,
|
|
85
|
+
value,
|
|
86
|
+
});
|
|
87
|
+
}, []);
|
|
88
|
+
|
|
89
|
+
const handleChangeParentCheckbox = useCallback(({ target: { name, value } }) => {
|
|
90
|
+
dispatch({
|
|
91
|
+
type: 'ON_CHANGE_TOGGLE_PARENT_CHECKBOX',
|
|
92
|
+
keys: name,
|
|
93
|
+
value,
|
|
94
|
+
});
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<PermissionsDataManagerProvider
|
|
99
|
+
value={{
|
|
100
|
+
availableConditions: layout.conditions,
|
|
101
|
+
modifiedData,
|
|
102
|
+
onChangeConditions: handleChangeConditions,
|
|
103
|
+
onChangeSimpleCheckbox: handleChangeSimpleCheckbox,
|
|
104
|
+
onChangeParentCheckbox: handleChangeParentCheckbox,
|
|
105
|
+
onChangeCollectionTypeLeftActionRowCheckbox: handleChangeCollectionTypeLeftActionRowCheckbox,
|
|
106
|
+
onChangeCollectionTypeGlobalActionCheckbox: handleChangeCollectionTypeGlobalActionCheckbox,
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<Tabs tabsLabel={TAB_LABELS}>
|
|
110
|
+
<ContentTypes
|
|
111
|
+
layout={layouts.collectionTypes}
|
|
112
|
+
kind="collectionTypes"
|
|
113
|
+
isFormDisabled={isFormDisabled}
|
|
114
|
+
/>
|
|
115
|
+
<ContentTypes
|
|
116
|
+
layout={layouts.singleTypes}
|
|
117
|
+
kind="singleTypes"
|
|
118
|
+
isFormDisabled={isFormDisabled}
|
|
119
|
+
/>
|
|
120
|
+
<PluginsAndSettings
|
|
121
|
+
layout={layouts.plugins}
|
|
122
|
+
kind="plugins"
|
|
123
|
+
isFormDisabled={isFormDisabled}
|
|
124
|
+
/>
|
|
125
|
+
<PluginsAndSettings
|
|
126
|
+
layout={layouts.settings}
|
|
127
|
+
kind="settings"
|
|
128
|
+
isFormDisabled={isFormDisabled}
|
|
129
|
+
/>
|
|
130
|
+
</Tabs>
|
|
131
|
+
</PermissionsDataManagerProvider>
|
|
132
|
+
);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
Permissions.defaultProps = {
|
|
136
|
+
permissions: [],
|
|
137
|
+
layout: {
|
|
138
|
+
conditions: [],
|
|
139
|
+
sections: {
|
|
140
|
+
collectionTypes: {},
|
|
141
|
+
singleTypes: {
|
|
142
|
+
actions: [],
|
|
143
|
+
},
|
|
144
|
+
settings: [],
|
|
145
|
+
plugins: [],
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
Permissions.propTypes = {
|
|
150
|
+
layout: PropTypes.object,
|
|
151
|
+
isFormDisabled: PropTypes.bool.isRequired,
|
|
152
|
+
permissions: PropTypes.array,
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export default memo(Permissions);
|