Created a simple permissions system for users
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import {Type} from "@/interfaces/user";
|
||||
import axios from "axios";
|
||||
import Link from "next/link";
|
||||
import {useRouter} from "next/router";
|
||||
@@ -7,12 +8,13 @@ import {MenuItem} from "primereact/menuitem";
|
||||
|
||||
interface Props {
|
||||
profilePicture: string;
|
||||
userType: Type;
|
||||
timer?: number;
|
||||
showExamEnd?: boolean;
|
||||
}
|
||||
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
export default function Navbar({profilePicture, timer, showExamEnd = false}: Props) {
|
||||
export default function Navbar({profilePicture, userType, timer, showExamEnd = false}: Props) {
|
||||
const router = useRouter();
|
||||
|
||||
const logout = async () => {
|
||||
@@ -41,7 +43,7 @@ export default function Navbar({profilePicture, timer, showExamEnd = false}: Pro
|
||||
label: "Users",
|
||||
icon: "pi pi-fw pi-users",
|
||||
items: [
|
||||
{label: "List", icon: "pi pi-fw pi-users", url: "/users"},
|
||||
...(userType === "student" ? [] : [{label: "List", icon: "pi pi-fw pi-users", url: "/users"}]),
|
||||
{label: "Stats", icon: "pi pi-fw pi-chart-pie", url: "/stats"},
|
||||
{label: "History", icon: "pi pi-fw pi-history", url: "/history"},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user