Allow non-admin users (user/viewer) to access / and /profile while blocking admin-only pages. The dashboard layout now uses requireUser() instead of requireAdmin(), and the sidebar filters nav items by role. Non-admin users see a minimal welcome page without stat cards. New test files (86 tests across 7 files): - dashboard, users, groups, api-docs, portal, link-account specs - role-access spec with full RBAC coverage for all 3 roles Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9 lines
364 B
TypeScript
9 lines
364 B
TypeScript
import type { ReactNode } from "react";
|
|
import { requireUser } from "@/src/lib/auth";
|
|
import DashboardLayoutClient from "./DashboardLayoutClient";
|
|
|
|
export default async function DashboardLayout({ children }: { children: ReactNode }) {
|
|
const session = await requireUser();
|
|
return <DashboardLayoutClient user={session.user}>{children}</DashboardLayoutClient>;
|
|
}
|