Added permission to codes
This commit is contained in:
@@ -14,6 +14,7 @@ import BatchCodeGenerator from "./(admin)/BatchCodeGenerator";
|
||||
import {shouldRedirectHome} from "@/utils/navigation.disabled";
|
||||
import ExamGenerator from "./(admin)/ExamGenerator";
|
||||
import BatchCreateUser from "./(admin)/BatchCreateUser";
|
||||
import { checkAccess, getTypesOfUser } from "@/utils/permissions";
|
||||
|
||||
export const getServerSideProps = withIronSessionSsr(({req, res}) => {
|
||||
const user = req.session.user;
|
||||
@@ -60,7 +61,7 @@ export default function Admin() {
|
||||
<section className="w-full flex -md:flex-col -xl:gap-2 gap-8 justify-between">
|
||||
<ExamLoader />
|
||||
<BatchCreateUser user={user} />
|
||||
{user.type !== "teacher" && (
|
||||
{checkAccess(user, getTypesOfUser(["teacher"]), 'viewCodes') && (
|
||||
<>
|
||||
<CodeGenerator user={user} />
|
||||
<BatchCodeGenerator user={user} />
|
||||
|
||||
Reference in New Issue
Block a user