Skip to content

Commit

Permalink
fix right access
Browse files Browse the repository at this point in the history
  • Loading branch information
Neo-Ryo committed May 29, 2024
1 parent 5ba423f commit 65b7b3a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/admin/NewAdminNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const NewAdminNavigation = () => {
const [selectedTab, setSelectedTab] = React.useState('Créer');

const tabs: Tab[] = [
{ path: '/admin/newportal/create', label: 'Créer', Icon: CreerIcon, rights: [UserType.ADMIN] },
{ path: '/admin/newportal/create', label: 'Créer', Icon: CreerIcon, rights: [UserType.ADMIN, UserType.SUPER_ADMIN, UserType.MEDIATOR] },
{ path: '/admin/newportal/publish', label: 'Publier', Icon: PublierIcon, rights: [UserType.ADMIN] },
{ path: '/admin/newportal/manage', label: 'Gérer', Icon: GererIcon, rights: [UserType.ADMIN] },
{ path: '/admin/newportal/analyze', label: 'Analyser', Icon: AnalyserIcon, rights: [UserType.ADMIN, UserType.OBSERVATOR, UserType.MEDIATOR] },
Expand Down
8 changes: 8 additions & 0 deletions src/pages/admin/newportal/manage/access/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import Link from 'next/link';
import React from 'react';

import { UserContext } from 'src/contexts/userContext';
import BackArrow from 'src/svg/back-arrow.svg';
import { UserType } from 'types/user.type';

const Access = () => {
const { user } = React.useContext(UserContext);
const hasAccess = user?.type === UserType.SUPER_ADMIN;

if (!hasAccess) {
return <h1>Vous n&apos;avez pas accès à cette page, vous devez être super admin.</h1>;
}
return (
<div>
<Link href="/admin/newportal/manage">
Expand Down
8 changes: 8 additions & 0 deletions src/pages/admin/newportal/manage/activities/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import Link from 'next/link';
import React from 'react';

import { UserContext } from 'src/contexts/userContext';
import BackArrow from 'src/svg/back-arrow.svg';
import { UserType } from 'types/user.type';

const Activities = () => {
const { user } = React.useContext(UserContext);
const hasAccess = user?.type === UserType.SUPER_ADMIN;

if (!hasAccess) {
return <h1>Vous n&apos;avez pas accès à cette page, vous devez être super admin.</h1>;
}
return (
<div>
<Link href="/admin/newportal/manage">
Expand Down
8 changes: 8 additions & 0 deletions src/pages/admin/newportal/manage/settings/archive/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import Link from 'next/link';
import React from 'react';

import { UserContext } from 'src/contexts/userContext';
import BackArrow from 'src/svg/back-arrow.svg';
import { UserType } from 'types/user.type';

const Archive = () => {
const { user } = React.useContext(UserContext);
const hasAccess = user?.type === UserType.SUPER_ADMIN;

if (!hasAccess) {
return <h1>Vous n&apos;avez pas accès à cette page, vous devez être super admin.</h1>;
}
return (
<div>
<Link href="/admin/newportal/manage/settings">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/admin/newportal/manage/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Gerer = () => {

const links: Link[] = [
{ name: 'Archiver', link: '/admin/newportal/manage/settings/archive', rights: [UserType.SUPER_ADMIN] },
{ name: 'Présenatation de Pélico', link: '/admin/newportal/manage/settings/pelico', rights: [UserType.ADMIN, UserType.SUPER_ADMIN] },
{ 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] },
];
Expand Down

0 comments on commit 65b7b3a

Please sign in to comment.