diff --git a/packages/volto/news/6355.bugfix b/packages/volto/news/6355.bugfix new file mode 100644 index 00000000000..3e1d43a40b0 --- /dev/null +++ b/packages/volto/news/6355.bugfix @@ -0,0 +1 @@ +Fix site setup access check by using @actions endpoint to validate permissions. @Faakhir30 diff --git a/packages/volto/src/components/manage/Toolbar/PersonalTools.jsx b/packages/volto/src/components/manage/Toolbar/PersonalTools.jsx index 0a11e8fd6ae..5f26e38a862 100644 --- a/packages/volto/src/components/manage/Toolbar/PersonalTools.jsx +++ b/packages/volto/src/components/manage/Toolbar/PersonalTools.jsx @@ -9,15 +9,12 @@ import { FormattedMessage, useIntl, defineMessages } from 'react-intl'; import { Icon } from '@plone/volto/components'; import { getUser } from '@plone/volto/actions'; import { Pluggable } from '@plone/volto/components/manage/Pluggable'; -import { - expandToBackendURL, - getBaseUrl, - userHasRoles, -} from '@plone/volto/helpers'; +import { expandToBackendURL, getBaseUrl } from '@plone/volto/helpers'; import logoutSVG from '@plone/volto/icons/log-out.svg'; import rightArrowSVG from '@plone/volto/icons/right-key.svg'; import backSVG from '@plone/volto/icons/back.svg'; import cameraSVG from '@plone/volto/icons/camera.svg'; +import { find } from 'lodash'; const messages = defineMessages({ back: { @@ -50,7 +47,9 @@ const PersonalTools = (props) => { const token = useSelector((state) => state.userSession.token, shallowEqual); const user = useSelector((state) => state.users.user); const userId = token ? jwtDecode(token).sub : ''; - + const siteSetupAction = find(props.actions.user, { + id: 'plone_setup', + }); useEffect(() => { dispatch(getUser(userId)); }, [dispatch, userId]); @@ -127,7 +126,7 @@ const PersonalTools = (props) => { - {userHasRoles(user, ['Site Administrator', 'Manager']) && ( + {siteSetupAction && (