From fff8187e659ecffe5fffaf8dfdecd85ac634bcd5 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 1 Nov 2022 17:12:09 -0700 Subject: Devices page permissions --- modern/src/settings/components/SettingsMenu.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'modern/src/settings/components') diff --git a/modern/src/settings/components/SettingsMenu.js b/modern/src/settings/components/SettingsMenu.js index 6a431ba1..4ba917aa 100644 --- a/modern/src/settings/components/SettingsMenu.js +++ b/modern/src/settings/components/SettingsMenu.js @@ -16,7 +16,7 @@ import SmartphoneIcon from '@mui/icons-material/Smartphone'; import { Link, useLocation } from 'react-router-dom'; import { useSelector } from 'react-redux'; import { useTranslation } from '../../common/components/LocalizationProvider'; -import { useAdministrator, useManager, useRestriction } from '../../common/util/permissions'; +import { useAdministrator, useDeviceReadonly, useManager, useRestriction } from '../../common/util/permissions'; import useFeatures from '../../common/util/useFeatures'; const MenuItem = ({ @@ -33,6 +33,7 @@ const SettingsMenu = () => { const location = useLocation(); const readonly = useRestriction('readonly'); + const deviceReadonly = useDeviceReadonly(); const admin = useAdministrator(); const manager = useManager(); const userId = useSelector((state) => state.session.user.id); @@ -62,12 +63,14 @@ const SettingsMenu = () => { icon={} selected={location.pathname === `/settings/user/${userId}`} /> - } - selected={location.pathname.startsWith('/settings/device')} - /> + {!deviceReadonly && ( + } + selected={location.pathname.startsWith('/settings/device')} + /> + )}