diff --git a/src/components/Layout/Sidebar/index.tsx b/src/components/Layout/Sidebar/index.tsx index 127b20298..af54340ce 100644 --- a/src/components/Layout/Sidebar/index.tsx +++ b/src/components/Layout/Sidebar/index.tsx @@ -3,6 +3,7 @@ import Transition from '../../Transition'; import Link from 'next/link'; import { useRouter } from 'next/router'; import { defineMessages, FormattedMessage } from 'react-intl'; +import { useUser, Permission } from '../../../hooks/useUser'; const messages = defineMessages({ dashboard: 'Dashboard', @@ -21,6 +22,7 @@ interface SidebarLinkProps { messagesKey: keyof typeof messages; activeRegExp: RegExp; as?: string; + requiredPermission?: Permission | Permission[]; } const SidebarLinks: SidebarLinkProps[] = [ @@ -92,11 +94,13 @@ const SidebarLinks: SidebarLinkProps[] = [ ), activeRegExp: /^\/settings/, + requiredPermission: Permission.MANAGE_SETTINGS, }, ]; const Sidebar: React.FC = ({ open, setClosed }) => { const router = useRouter(); + const { hasPermission } = useUser(); return ( <>
@@ -156,7 +160,11 @@ const Sidebar: React.FC = ({ open, setClosed }) => {