POPIA toolkit part 2: privacy notice editor, operators, consent and access logs
- Admin -> Privacy (POPIA): edit the privacy notice (built-in text as the
start, placeholders for org/IO/operators), drafts, preview, numbered
versions; earlier versions readable on /legal/privacy?version=N
- "Significant change" versions are accepted once after login
(NoticePrompt); sign-up records the version accepted
- Operator register (seeded with the services the app uses), listed in
the notice via {operators}
- Consent log (news opt-ins, notice acceptances, parental consent) and
access log (report exports, registers, certificates, group lists, form
answers, consent/medical lists, backups, impersonation)
- Information Officer on the contact page
- Unit tests (privacyNotice.test.js), e2e (privacy-notice.spec.ts); docs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012mt6TCv85T9VKRq3cV7rXq
This commit is contained in:
@@ -81,6 +81,9 @@ model User {
|
||||
newsWhatsApp Boolean @default(false)
|
||||
// When the person last answered the news opt-in question. Null = ask at next login.
|
||||
newsAskedAt DateTime?
|
||||
// The privacy notice version they last accepted (0 = the built-in notice). Null = never
|
||||
// recorded. Asked again when a version that needs re-acceptance is newer.
|
||||
noticeVersionAccepted Int?
|
||||
registrations Registration[]
|
||||
payments Payment[]
|
||||
paymentsRecorded Payment[] @relation("PaymentRecordedBy")
|
||||
@@ -130,6 +133,9 @@ model User {
|
||||
communicationConsents CommunicationConsent[]
|
||||
dataRequests DataRequest[]
|
||||
dataRequestsHandled DataRequest[] @relation("DataRequestHandledBy")
|
||||
noticesPublished PrivacyNotice[]
|
||||
noticeAcceptances NoticeAcceptance[]
|
||||
dataAccessLogs DataAccessLog[]
|
||||
}
|
||||
|
||||
model Event {
|
||||
@@ -583,6 +589,10 @@ enum AdminAuditAction {
|
||||
data_request_completed
|
||||
data_request_rejected
|
||||
user_anonymised
|
||||
privacy_notice_published
|
||||
operator_created
|
||||
operator_updated
|
||||
operator_deleted
|
||||
}
|
||||
|
||||
// Append-only audit trail for admin/supervisor-initiated actions with money or
|
||||
@@ -1651,3 +1661,73 @@ model DataRequest {
|
||||
@@index([status, dueAt])
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
// A published version of the privacy notice (versions start at 1). With none published,
|
||||
// the built-in notice from utils/privacyNotice.js is shown as version 0. Section bodies
|
||||
// keep their {placeholders} (org name, Information Officer, operators…), filled in when
|
||||
// shown, so the notice follows Site settings and the operator register.
|
||||
model PrivacyNotice {
|
||||
id String @id @default(uuid())
|
||||
version Int @unique
|
||||
sections Json // [{ id, title, body }]
|
||||
changeSummary String?
|
||||
// Everyone is asked to accept this version again after logging in.
|
||||
requiresAcceptance Boolean @default(false)
|
||||
publishedAt DateTime @default(now())
|
||||
publishedById String?
|
||||
publishedBy User? @relation(fields: [publishedById], references: [id], onDelete: SetNull)
|
||||
}
|
||||
|
||||
// Someone accepted a version of the privacy notice. Append-only proof, like
|
||||
// CommunicationConsent.
|
||||
model NoticeAcceptance {
|
||||
id String @id @default(uuid())
|
||||
userId String?
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
version Int
|
||||
source String // signup | prompt
|
||||
ip String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([userId, createdAt])
|
||||
@@index([version])
|
||||
}
|
||||
|
||||
// A third party that processes personal information for the church (POPIA "operator"):
|
||||
// payment providers, WhatsApp and email delivery, hosting… Active ones are listed in the
|
||||
// privacy notice.
|
||||
model Operator {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
purpose String
|
||||
dataShared String
|
||||
location String?
|
||||
website String?
|
||||
active Boolean @default(true)
|
||||
order Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
// Someone exported or viewed personal information in bulk: report exports, the attendance
|
||||
// register, certificate downloads, group lists, form answers, the consent and medical lists,
|
||||
// backups, and viewing the site as another user.
|
||||
model DataAccessLog {
|
||||
id String @id @default(uuid())
|
||||
actorId String?
|
||||
actor User? @relation(fields: [actorId], references: [id], onDelete: SetNull)
|
||||
actorRole String
|
||||
// report_pdf | report_excel | report_email | report_whatsapp | attendance_export |
|
||||
// certificates_download | group_lists | form_responses | consent_list | medical_list |
|
||||
// backup_download | impersonation
|
||||
action String
|
||||
what String
|
||||
eventId String?
|
||||
records Int?
|
||||
ip String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([createdAt])
|
||||
@@index([actorId, createdAt])
|
||||
@@index([action, createdAt])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user