Archived
- Retention policies (Admin -> Privacy -> Retention) applied by a nightly
`retention` job: inactive accounts anonymised after 5 years with a
30-day warning (on by default; never staff roles or people with an
upcoming registration), form answers, login history, payer details in
payment notifications, audit/access logs
- User.lastLoginAt (set on login, backfilled) and inactivityWarnedAt
- Breach register (SecurityBreach) with drafts for the people affected
and the Information Regulator
- Readiness checklist with a score
- Children's/medical flag in the access log; {retention} placeholder in
the privacy notice
- Unit tests (retention.test.js), e2e (privacy-retention.spec.ts); docs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012mt6TCv85T9VKRq3cV7rXq
82 lines
3.8 KiB
TypeScript
82 lines
3.8 KiB
TypeScript
"use client";
|
|
|
|
import React, { Suspense } from "react";
|
|
import Link from "next/link";
|
|
import { useRouter, useSearchParams } from "next/navigation";
|
|
import { ShieldCheck, ScrollText, Building2, ListChecks, Eye, Inbox, Gauge, Timer, AlertTriangle } from "lucide-react";
|
|
import { useAuth } from "@/hooks/useAuth";
|
|
import { BackLink } from "@/components/shared/BackLink";
|
|
import { NoticeEditor } from "@/components/admin/privacy/NoticeEditor";
|
|
import { OperatorsPanel } from "@/components/admin/privacy/OperatorsPanel";
|
|
import { ConsentLogPanel, AccessLogPanel } from "@/components/admin/privacy/LogPanels";
|
|
import { ReadinessPanel } from "@/components/admin/privacy/ReadinessPanel";
|
|
import { RetentionPanel } from "@/components/admin/privacy/RetentionPanel";
|
|
import { BreachesPanel } from "@/components/admin/privacy/BreachesPanel";
|
|
|
|
const TABS = [
|
|
{ key: "readiness", label: "Readiness", icon: Gauge },
|
|
{ key: "notice", label: "Privacy notice", icon: ScrollText },
|
|
{ key: "operators", label: "Operators", icon: Building2 },
|
|
{ key: "retention", label: "Retention", icon: Timer },
|
|
{ key: "consent", label: "Consent log", icon: ListChecks },
|
|
{ key: "access", label: "Access log", icon: Eye },
|
|
{ key: "breaches", label: "Breaches", icon: AlertTriangle },
|
|
] as const;
|
|
type TabKey = (typeof TABS)[number]["key"];
|
|
|
|
function PrivacyAdmin() {
|
|
const { token } = useAuth();
|
|
const router = useRouter();
|
|
const params = useSearchParams();
|
|
const tab = (TABS.find(t => t.key === params.get("tab"))?.key || "readiness") as TabKey;
|
|
|
|
return (
|
|
<div className="max-w-5xl mx-auto w-full">
|
|
<div className="mb-6">
|
|
<BackLink href="/dashboard/admin" />
|
|
<div className="flex items-center gap-2 mt-0.5">
|
|
<ShieldCheck className="w-6 h-6 text-brand-600" />
|
|
<h1 className="text-2xl font-semibold text-gray-900">Privacy (POPIA)</h1>
|
|
</div>
|
|
<p className="text-sm text-gray-500 mt-1">
|
|
Your privacy notice, the services that process personal information for you, and the records that show how it's handled.
|
|
People's requests are on <Link href="/dashboard/admin/data-requests" className="text-brand-600 hover:underline inline-flex items-center gap-1"><Inbox className="w-3.5 h-3.5" />Data requests</Link>;
|
|
the Information Officer is set in <Link href="/dashboard/admin/settings" className="text-brand-600 hover:underline">Site settings → Legal</Link>.
|
|
</p>
|
|
</div>
|
|
|
|
<div className="flex flex-wrap gap-2 mb-5" role="tablist">
|
|
{TABS.map(t => {
|
|
const Icon = t.icon;
|
|
return (
|
|
<button key={t.key} role="tab" aria-selected={tab === t.key} onClick={() => router.replace(`/dashboard/admin/privacy?tab=${t.key}`)}
|
|
className={`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium ${tab === t.key ? "bg-brand-600 text-white" : "bg-white border text-gray-700 hover:bg-gray-50"}`}>
|
|
<Icon className="w-4 h-4" /> {t.label}
|
|
</button>
|
|
);
|
|
})}
|
|
</div>
|
|
|
|
{token && (
|
|
<div className="border rounded-xl p-5 bg-white shadow-sm">
|
|
{tab === "readiness" && <ReadinessPanel token={token} />}
|
|
{tab === "notice" && <NoticeEditor token={token} />}
|
|
{tab === "operators" && <OperatorsPanel token={token} />}
|
|
{tab === "retention" && <RetentionPanel token={token} />}
|
|
{tab === "consent" && <ConsentLogPanel token={token} />}
|
|
{tab === "access" && <AccessLogPanel token={token} />}
|
|
{tab === "breaches" && <BreachesPanel token={token} />}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default function PrivacyAdminPage() {
|
|
return (
|
|
<Suspense fallback={<p className="text-sm text-gray-400">Loading…</p>}>
|
|
<PrivacyAdmin />
|
|
</Suspense>
|
|
);
|
|
}
|