| 1 | import { notFound } from "next/navigation"; |
| 2 | |
| 3 | import PresentationPage from "@/components/presentation/core/PresentationPage"; |
| 4 | import { |
| 5 | getDocumentAccessForUser, |
| 6 | getSessionIdentity, |
| 7 | } from "@/server/share/authorization"; |
| 8 | |
| 9 | export const dynamic = "force-dynamic"; |
| 10 | |
| 11 | export default async function Page(props: { params: Promise<{ id: string }> }) { |
| 12 | const [params, { userId, userEmail }] = await Promise.all([ |
| 13 | props.params, |
| 14 | getSessionIdentity(), |
| 15 | ]); |
| 16 | const access = await getDocumentAccessForUser(params.id, userId, userEmail); |
| 17 | |
| 18 | if (!access.canRead) { |
| 19 | notFound(); |
| 20 | } |
| 21 | |
| 22 | return <PresentationPage readOnly={!access.canEdit} />; |
| 23 | } |
| 24 |