/legal is the counsel-only workspace for managing global legal documents
(Terms of Service, Privacy Policy, Terms of Use, DPA, compliance posture) and
reviewing the audit trail of sensitive record access and modifications. The hub
page (page.tsx) links the two sub-areas as cards; each sub-area is a
server/client pair (page.tsx fetches, ClientPage.tsx renders).
| Route | Purpose | Guard |
|---|---|---|
/legal | Hub — links to Policies and Audit Logs | org:legal:audit_view (layout.tsx) |
/legal/policies | Edit, review, and publish the five global policies | org:legal:audit_view (route) — writes and publishing need org:legal:policies_edit |
/legal/audit | Access/modification log for sensitive legal records (first 100 entries server-loaded) | org:legal:policies_edit (page.tsx) |
The module gate lives in
layout.tsx
via requirePermission("org:legal:audit_view"). Note the audit page re-gates
tighter than the hub: it requires org:legal:policies_edit, so read-only
counsel sees the hub but not the log contents.
| Source | Purpose |
|---|---|
MongoDB legal_policies | Policy documents and versions |
MongoDB audit_logs (via lib/security/audit.ts getAuditLogs) | Access/modification trail, serialised for the client |
WordPress (getLegalPolicyBySlug) | Initial policy bodies hydrated into the Policies client page |
Policy slugs read on load: terms-of-service, privacy-policy, terms-of-use,
data-processing-agreement, compliance-posture. HTML is stripped for the DPA
and compliance-posture editors, which work in plain text.
org:legal:*audit_logs store