papertrail/components/sso/AdminGate.tsx
caelum0x 695a365ae4 feat: PaperTrail — enterprise evidence-verification platform
Multi-tenant platform (182 pages, 228 API routes, ~30 modules) built on a
deterministic verification core: clinical-trial claims checked against
ClinicalTrials.gov registered results and raw event counts (ARR/NNT/RR+CI
recomputed in code, oracle-tested), code-enforced exact-span grounding, and
multi-source cross-verification. Auth/RBAC/multi-tenancy, document processing
at scale (unpdf + Docling), agentic workflows, Claude Science connector,
compliance/audit, billing, public API, and more.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 07:21:22 +03:00

33 lines
864 B
TypeScript

"use client";
import { useCurrentRole } from "@/components/org-team/useCurrentRole";
// Client-side admin gate for the SSO settings surfaces. Mirrors the server-side
// requireRole("admin") in the API so non-admins get a clear message instead of a
// broken page. UX-only — the API is the real enforcement point.
export function AdminGate({
title,
children,
}: {
title: string;
children: React.ReactNode;
}) {
const { canManage, loading } = useCurrentRole();
if (loading) {
return <p className="text-sm text-ink/40">Loading…</p>;
}
if (!canManage) {
return (
<div>
<h1 className="text-2xl font-semibold text-ink/80">{title}</h1>
<p className="mt-4 text-sm text-ink/60">
You need an admin or owner role to manage {title.toLowerCase()}.
</p>
</div>
);
}
return <>{children}</>;
}