import { NextResponse } from "next/server"; import { auth } from "@homarr/auth/next"; type RouteHandler = (...args: Arguments) => Response | Promise; export const adminRoute = (handler: RouteHandler) => async (...args: Arguments): Promise => { const session = await auth(); if (!session?.user.permissions.includes("admin")) { return NextResponse.json({ error: "Administrator access is required." }, { status: 403 }); } return handler(...args); };