Add Admin Reports page #2

This commit is contained in:
nocnico
2025-04-28 22:59:46 +02:00
parent 7670843613
commit 0d7f0ad2b8
6 changed files with 273 additions and 7 deletions

View File

@@ -0,0 +1,24 @@
import { prisma } from "@repo/db";
import { Error } from "_components/Error";
import { getServerSession } from "api/auth/[...nextauth]/auth";
export default async function ReportLayout({
children,
}: {
children: React.ReactNode;
}) {
const session = await getServerSession();
if (!session) return <Error title="Nicht eingeloggt" statusCode={401} />;
const user = await prisma.user.findUnique({
where: {
id: session.user.id,
},
});
if (!user?.permissions.includes("ADMIN_EVENT"))
return <Error title="Keine Berechtigung" statusCode={403} />;
return <>{children}</>;
}