Spaces:
Sleeping
Sleeping
feat: implement role-based access control UI - hide/show features based on user role (viewer/editor/admin/owner)
dc11950
| "use client"; | |
| import Link from "next/link"; | |
| import { KnowledgeBasePanel } from "@/components/knowledge-base-panel"; | |
| import { Footer } from "@/components/footer"; | |
| import { TenantSelector } from "@/components/tenant-selector"; | |
| import { useTenant } from "@/contexts/TenantContext"; | |
| import { canIngestDocuments } from "@/lib/permissions"; | |
| export default function IngestionPage() { | |
| const { role } = useTenant(); | |
| if (!canIngestDocuments(role)) { | |
| return ( | |
| <main className="mx-auto flex min-h-screen max-w-5xl flex-col gap-10 px-4 pb-16 pt-12 sm:px-6 lg:px-8"> | |
| <header className="flex flex-col gap-4 rounded-2xl border border-white/10 bg-white/5 px-6 py-6 text-slate-100 shadow-lg shadow-slate-950/40"> | |
| <div className="flex items-center justify-between gap-3"> | |
| <div className="flex items-center gap-3 text-base font-semibold"> | |
| <span className="inline-flex h-10 w-10 items-center justify-center rounded-2xl bg-gradient-to-br from-sky-400 to-cyan-500 text-slate-950"> | |
| IC | |
| </span> | |
| IntegraChat · Data Ingestion | |
| </div> | |
| <div className="flex items-center gap-4"> | |
| <TenantSelector /> | |
| <Link href="/" className="text-xs font-semibold uppercase tracking-[0.3em] text-cyan-300 hover:text-white"> | |
| ← Back Home | |
| </Link> | |
| </div> | |
| </div> | |
| </header> | |
| <div className="rounded-2xl border border-red-500/50 bg-red-500/10 p-8 text-center"> | |
| <h2 className="text-2xl font-bold text-red-300 mb-2">Access Denied</h2> | |
| <p className="text-slate-300 mb-4"> | |
| You need <strong>Editor</strong>, <strong>Admin</strong>, or <strong>Owner</strong> role to ingest documents. | |
| </p> | |
| <p className="text-sm text-slate-400"> | |
| Your current role: <strong className="text-slate-200">{role.charAt(0).toUpperCase() + role.slice(1)}</strong> | |
| </p> | |
| <p className="text-sm text-slate-400 mt-2"> | |
| Please switch your role using the dropdown in the header. | |
| </p> | |
| </div> | |
| <Footer /> | |
| </main> | |
| ); | |
| } | |
| return ( | |
| <main className="mx-auto flex min-h-screen max-w-5xl flex-col gap-10 px-4 pb-16 pt-12 sm:px-6 lg:px-8"> | |
| <header className="flex flex-col gap-4 rounded-2xl border border-white/10 bg-white/5 px-6 py-6 text-slate-100 shadow-lg shadow-slate-950/40"> | |
| <div className="flex items-center justify-between gap-3"> | |
| <div className="flex items-center gap-3 text-base font-semibold"> | |
| <span className="inline-flex h-10 w-10 items-center justify-center rounded-2xl bg-gradient-to-br from-sky-400 to-cyan-500 text-slate-950"> | |
| IC | |
| </span> | |
| IntegraChat · Data Ingestion | |
| </div> | |
| <div className="flex items-center gap-4"> | |
| <TenantSelector /> | |
| <Link href="/" className="text-xs font-semibold uppercase tracking-[0.3em] text-cyan-300 hover:text-white"> | |
| ← Back Home | |
| </Link> | |
| </div> | |
| </div> | |
| <p className="text-sm text-slate-300"> | |
| Upload raw text, URLs, or documents to feed the tenant-specific RAG index. All inputs flow into the FastAPI + | |
| MCP ingestion pipeline. | |
| </p> | |
| </header> | |
| <KnowledgeBasePanel /> | |
| <Footer /> | |
| </main> | |
| ); | |
| } | |