diff --git a/src/api/archive/archive.get.ts b/src/api/archive/archive.get.ts index 07389117d..a4bbbdf00 100644 --- a/src/api/archive/archive.get.ts +++ b/src/api/archive/archive.get.ts @@ -11,7 +11,7 @@ const BASE_URL = '/api/archives'; export const useListArchives = () => { const { user } = React.useContext(UserContext); - const hasAccess = user?.type === UserType.SUPER_ADMIN || user?.type === UserType.ADMIN || user?.type === UserType.MEDIATOR; + const hasAccess = user !== null && user.type in [UserType.ADMIN, UserType.SUPER_ADMIN, UserType.MEDIATOR]; return useQuery( ['archives'], diff --git a/src/components/admin/NewAdminNavigation.tsx b/src/components/admin/NewAdminNavigation.tsx index 7b94fe7d5..5dbed96b1 100644 --- a/src/components/admin/NewAdminNavigation.tsx +++ b/src/components/admin/NewAdminNavigation.tsx @@ -59,7 +59,7 @@ export const NewAdminNavigation = () => { const tabs: Tab[] = [ { path: '/admin/newportal/create', label: 'Créer', Icon: CreerIcon, rights: [UserType.ADMIN, UserType.SUPER_ADMIN, UserType.MEDIATOR] }, { path: '/admin/newportal/publier', label: 'Publier', Icon: PublierIcon, rights: [UserType.ADMIN, UserType.SUPER_ADMIN] }, - { path: '/admin/newportal/manage', label: 'Gérer', Icon: GererIcon, rights: [UserType.ADMIN, UserType.SUPER_ADMIN] }, + { path: '/admin/newportal/manage', label: 'Gérer', Icon: GererIcon, rights: [UserType.ADMIN, UserType.SUPER_ADMIN, UserType.MEDIATOR] }, { path: '/admin/newportal/analyze', label: 'Analyser', diff --git a/src/pages/admin/newportal/manage/index.tsx b/src/pages/admin/newportal/manage/index.tsx index 868324d77..11483cea7 100644 --- a/src/pages/admin/newportal/manage/index.tsx +++ b/src/pages/admin/newportal/manage/index.tsx @@ -15,7 +15,7 @@ type Link = { const Gerer = () => { const { user } = React.useContext(UserContext); - const hasAccess = user !== null && user.type in [UserType.ADMIN, UserType.SUPER_ADMIN]; + const hasAccess = user !== null && user.type in [UserType.ADMIN, UserType.SUPER_ADMIN, UserType.MEDIATOR]; if (!hasAccess) { return

Vous n'avez pas accès à cette page, vous devez être super admin.

; @@ -28,7 +28,7 @@ const Gerer = () => { link: '/admin/newportal/manage/activities', rights: [UserType.SUPER_ADMIN], }, - { name: 'Paramétrer 1Village', link: '/admin/newportal/manage/settings', rights: [UserType.ADMIN, UserType.SUPER_ADMIN] }, + { name: 'Paramétrer 1Village', link: '/admin/newportal/manage/settings', rights: [UserType.ADMIN, UserType.SUPER_ADMIN, UserType.MEDIATOR] }, { name: "Les droits d'accès", link: '/admin/newportal/manage/access', rights: [UserType.SUPER_ADMIN] }, ]; diff --git a/src/pages/admin/newportal/manage/settings/archive/index.tsx b/src/pages/admin/newportal/manage/settings/archive/index.tsx index f3654d69a..95cbc857a 100644 --- a/src/pages/admin/newportal/manage/settings/archive/index.tsx +++ b/src/pages/admin/newportal/manage/settings/archive/index.tsx @@ -11,7 +11,7 @@ import { UserType } from 'types/user.type'; const Archive = () => { const { user } = React.useContext(UserContext); - const hasAccess = user?.type === UserType.SUPER_ADMIN; + const hasAccess = user !== null && user.type in [UserType.ADMIN, UserType.SUPER_ADMIN, UserType.MEDIATOR]; const [archives, setArchives] = useState([]); const { enqueueSnackbar } = useSnackbar(); diff --git a/src/pages/admin/newportal/manage/settings/index.tsx b/src/pages/admin/newportal/manage/settings/index.tsx index 446b54454..433a871f7 100644 --- a/src/pages/admin/newportal/manage/settings/index.tsx +++ b/src/pages/admin/newportal/manage/settings/index.tsx @@ -16,14 +16,14 @@ type Link = { const Gerer = () => { const { user } = React.useContext(UserContext); - const hasAccess = user !== null && user.type in [UserType.ADMIN, UserType.SUPER_ADMIN]; + const hasAccess = user !== null && user.type in [UserType.ADMIN, UserType.SUPER_ADMIN, UserType.MEDIATOR]; if (!hasAccess) { return

Vous n'avez pas accès à cette page, vous devez être modérateur ou super admin.

; } const links: Link[] = [ - { name: 'Archiver', link: '/admin/newportal/manage/settings/archive', rights: [UserType.SUPER_ADMIN] }, + { name: 'Archiver', link: '/admin/newportal/manage/settings/archive', rights: [UserType.SUPER_ADMIN, UserType.ADMIN, UserType.MEDIATOR] }, { name: 'Présentation de Pélico', link: '/admin/newportal/manage/settings/pelico', rights: [UserType.ADMIN, UserType.SUPER_ADMIN] }, { name: 'Paramétrer la home', link: '/admin/newportal/manage/settings/home', rights: [UserType.ADMIN, UserType.SUPER_ADMIN] }, { name: 'Paramétrer les phases', link: '/admin/newportal/manage/settings/phases', rights: [UserType.ADMIN, UserType.SUPER_ADMIN] },