From 05623d59c14896da5ac1b2527e93d4af50ec87b6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 4 May 2022 18:02:01 -0700 Subject: Handle user permissions --- modern/src/components/BottomMenu.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'modern/src/components/BottomMenu.js') diff --git a/modern/src/components/BottomMenu.js b/modern/src/components/BottomMenu.js index 087d241d..920622ae 100644 --- a/modern/src/components/BottomMenu.js +++ b/modern/src/components/BottomMenu.js @@ -9,9 +9,11 @@ import DescriptionIcon from '@material-ui/icons/Description'; import SettingsIcon from '@material-ui/icons/Settings'; import MapIcon from '@material-ui/icons/Map'; import PersonIcon from '@material-ui/icons/Person'; +import ExitToAppIcon from '@material-ui/icons/ExitToApp'; import { sessionActions } from '../store'; import { useTranslation } from '../LocalizationProvider'; +import { useReadonly } from '../common/permissions'; const BottomMenu = () => { const history = useHistory(); @@ -19,6 +21,7 @@ const BottomMenu = () => { const dispatch = useDispatch(); const t = useTranslation(); + const readonly = useReadonly(); const userId = useSelector((state) => state.session.user?.id); const [anchorEl, setAnchorEl] = useState(null); @@ -48,7 +51,11 @@ const BottomMenu = () => { history.push('/settings/preferences'); break; case 3: - setAnchorEl(event.currentTarget); + if (readonly) { + handleLogout(); + } else { + setAnchorEl(event.currentTarget); + } break; default: break; @@ -73,7 +80,10 @@ const BottomMenu = () => { } /> } /> } /> - } /> + {readonly + ? (} />) + : (} />) + } setAnchorEl(null)}> -- cgit v1.2.3