23 lines
819 B
TypeScript
23 lines
819 B
TypeScript
// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
|
|
// The audit log is for administrators (spec §9.4). The role is asked for in this layout and not in the
|
|
// page: the page has a loading state, a loading state starts the response, and the response's status
|
|
// is fixed once it starts -- a member below `admin` must get a real 403, and a stranger a real 404.
|
|
|
|
import type { ReactNode } from "react"
|
|
import { requireRole } from "../../../src/server/guard"
|
|
import { pageContext } from "../../../src/server/page"
|
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
export default async function AuditLayout({
|
|
children,
|
|
params,
|
|
}: {
|
|
children: ReactNode
|
|
params: Promise<{ org: string }>
|
|
}): Promise<ReactNode> {
|
|
const { org } = await params
|
|
await requireRole(await pageContext(), org, "admin")
|
|
return children
|
|
}
|