diff --git a/src/app/(withAuth)/courses/[courseId]/lectures/[lectureId]/problems/[problemId]/page.tsx b/src/app/(withAuth)/courses/[courseId]/lectures/[lectureId]/problems/[problemId]/page.tsx index d51e5ab2..f687eca0 100644 --- a/src/app/(withAuth)/courses/[courseId]/lectures/[lectureId]/problems/[problemId]/page.tsx +++ b/src/app/(withAuth)/courses/[courseId]/lectures/[lectureId]/problems/[problemId]/page.tsx @@ -1,4 +1,5 @@ import type { NextPage } from 'next'; +import SuperTokensNode from 'supertokens-node'; import { logger } from '../../../../../../../../infrastructures/pino'; import { prisma } from '../../../../../../../../infrastructures/prisma'; @@ -13,6 +14,8 @@ type Props = { const ProblemPage: NextPage = async (props) => { const session = await getNonNullableSessionOnServer(); + const superTokensUser = session && (await SuperTokensNode.getUser(session.superTokensUserId)); + const isAdmin = superTokensUser?.emails[0]?.endsWith('@internet.ac.jp'); let incompleteProblemSession = await prisma.problemSession.findFirst({ where: { @@ -42,6 +45,7 @@ const ProblemPage: NextPage = async (props) => { return ( diff --git a/src/app/(withAuth)/courses/[courseId]/lectures/[lectureId]/problems/[problemId]/pageOnClient.tsx b/src/app/(withAuth)/courses/[courseId]/lectures/[lectureId]/problems/[problemId]/pageOnClient.tsx index 6b98dfc9..8b791082 100644 --- a/src/app/(withAuth)/courses/[courseId]/lectures/[lectureId]/problems/[problemId]/pageOnClient.tsx +++ b/src/app/(withAuth)/courses/[courseId]/lectures/[lectureId]/problems/[problemId]/pageOnClient.tsx @@ -28,9 +28,10 @@ import { courseIdToLectureIds, courseIdToName, problemIdToName } from '../../../ import { ProblemBody } from './ProblmBody'; type Props = { + initialProblemSession: ProblemSession; + isAdmin: boolean | undefined; params: { courseId: CourseId; lectureId: string; problemId: ProblemId }; userId: string; - initialProblemSession: ProblemSession; }; export const ProblemPageOnClient: React.FC = (props) => { @@ -106,23 +107,41 @@ export const ProblemPageOnClient: React.FC = (props) => { {problemIdToName[props.params.problemId]} - - - + + + {props.isAdmin && ( + + )} +