feat: Consent Migration Phasen 3-6 — Cookie Banner, Deadlines, Public DSR, Integrations

Phase 3 (Cookie Banner): Backend + Frontend existierten bereits —
keine Aenderungen noetig.

Phase 4 (Deadlines): DeadlineTab mit Fristen-Timeline (30 Tage,
4 Erinnerungen, Auto-Sperrung). Backend-Cron in Production via Core.

Phase 5 (Public DSR): PublicFormConfig im DSR Settings-Tab —
konfigurierbare Anfragetypen, Identitaetspflicht, Embed-Code.

Phase 6 (Integrations): IntegrationStubs fuer Matrix, Jitsi, OAuth,
2FA, Notifications — vorbereitet fuer Core-Service-Anbindung.

Consent Management: 2 neue Tabs (Fristen, Integrationen).
DSR: Settings-Tab mit Public Form statt Platzhalter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-04-28 00:43:34 +02:00
parent 290254056e
commit 5ff65b3402
6 changed files with 280 additions and 12 deletions

View File

@@ -0,0 +1,90 @@
'use client'
import Link from 'next/link'
interface DeadlineConfig {
gracePeriodDays: number
reminderDays: number[]
suspendOnExpiry: boolean
}
export function DeadlineTab() {
// Phase 4: Deadline management — backend service pending (Core integration)
const config: DeadlineConfig = {
gracePeriodDays: 30,
reminderDays: [28, 21, 14, 7],
suspendOnExpiry: true,
}
return (
<div className="p-6 space-y-6">
<div className="flex items-center justify-between">
<h2 className="text-lg font-semibold text-slate-900">Fristen & Erinnerungen</h2>
<span className="px-2 py-1 bg-yellow-100 text-yellow-700 rounded text-xs">In Vorbereitung</span>
</div>
<div className="bg-blue-50 border border-blue-200 rounded-lg p-4 text-sm text-blue-800">
Das Fristen-System wird automatisch Erinnerungen an Nutzer senden, die neue Pflichtdokumente
noch nicht akzeptiert haben. Nach Ablauf der Frist wird der Account gesperrt bis die Zustimmung erfolgt.
Die E-Mail-Zustellung wird ueber den Core-Service in Production bereitgestellt.
</div>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div className="border border-slate-200 rounded-lg p-4">
<h3 className="text-sm font-medium text-slate-700">Nachfrist</h3>
<p className="text-2xl font-bold text-slate-900 mt-1">{config.gracePeriodDays} Tage</p>
<p className="text-xs text-slate-500 mt-1">Nach Veroeffentlichung eines Pflichtdokuments</p>
</div>
<div className="border border-slate-200 rounded-lg p-4">
<h3 className="text-sm font-medium text-slate-700">Erinnerungen</h3>
<p className="text-2xl font-bold text-slate-900 mt-1">{config.reminderDays.length}x</p>
<p className="text-xs text-slate-500 mt-1">
Tag {config.reminderDays.join(', ')} nach Veroeffentlichung
</p>
</div>
<div className="border border-slate-200 rounded-lg p-4">
<h3 className="text-sm font-medium text-slate-700">Auto-Sperrung</h3>
<p className="text-2xl font-bold text-slate-900 mt-1">{config.suspendOnExpiry ? 'Aktiv' : 'Inaktiv'}</p>
<p className="text-xs text-slate-500 mt-1">Account wird nach Fristablauf gesperrt</p>
</div>
</div>
<div className="border border-slate-200 rounded-lg p-4">
<h3 className="text-sm font-medium text-slate-700 mb-3">Erinnerungs-Timeline</h3>
<div className="flex items-center gap-1">
{Array.from({ length: 30 }, (_, i) => {
const day = 30 - i
const isReminder = config.reminderDays.includes(day)
const isDeadline = day === 0
return (
<div key={i} className="flex-1 relative group">
<div className={`h-2 rounded-sm ${
isDeadline ? 'bg-red-500' : isReminder ? 'bg-yellow-400' : 'bg-slate-100'
}`} />
{isReminder && (
<span className="absolute -top-5 left-1/2 -translate-x-1/2 text-[10px] text-yellow-600 whitespace-nowrap">
Tag {day}
</span>
)}
</div>
)
})}
<div className="flex-none w-3 h-2 bg-red-500 rounded-sm" title="Sperrung" />
</div>
<div className="flex justify-between mt-1 text-[10px] text-slate-400">
<span>Veroeffentlichung</span>
<span>Sperrung</span>
</div>
</div>
<div className="flex gap-3">
<Link href="/sdk/email-templates" className="text-sm text-purple-600 hover:underline">
E-Mail-Templates konfigurieren
</Link>
<Link href="/sdk/dsr" className="text-sm text-purple-600 hover:underline">
Betroffenenrechte verwalten
</Link>
</div>
</div>
)
}

View File

@@ -0,0 +1,72 @@
'use client'
const INTEGRATIONS = [
{
id: 'matrix',
name: 'Matrix Kommunikation',
description: 'Sichere, verschluesselte Kommunikation mit Betroffenen ueber Matrix-Protokoll. Wird in Production ueber den Core Communication Service bereitgestellt.',
status: 'planned',
icon: '💬',
},
{
id: 'jitsi',
name: 'Jitsi Video-Meetings',
description: 'DSGVO-konforme Video-Konsultationen mit Betroffenen fuer komplexe Datenschutzanfragen. Wird ueber den Core Jitsi Service bereitgestellt.',
status: 'planned',
icon: '📹',
},
{
id: 'oauth',
name: 'OAuth 2.0 Client-Verwaltung',
description: 'Verwaltung von OAuth-Clients fuer API-Zugriff auf Consent-Endpunkte. Authorization Code Flow mit PKCE-Support.',
status: 'planned',
icon: '🔑',
},
{
id: '2fa',
name: 'Zwei-Faktor-Authentifizierung',
description: 'TOTP-basierte Zwei-Faktor-Authentifizierung fuer Admin-Zugang. Recovery-Codes fuer Notfallzugriff.',
status: 'planned',
icon: '🛡️',
},
{
id: 'notifications',
name: 'Benachrichtigungssystem',
description: 'In-App und E-Mail Benachrichtigungen fuer Consent-Aenderungen, DSR-Fristen und Dokument-Updates. Praeferenz-Verwaltung pro Nutzer.',
status: 'planned',
icon: '🔔',
},
]
export function IntegrationStubs() {
return (
<div className="p-6 space-y-4">
<div className="flex items-center justify-between mb-2">
<h2 className="text-lg font-semibold text-slate-900">Integrationen</h2>
<span className="px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs">Production-Anbindung</span>
</div>
<p className="text-sm text-slate-500">
Diese Dienste werden in Production ueber die Core-Services bereitgestellt und sind
im SDK vorbereitet.
</p>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
{INTEGRATIONS.map(integration => (
<div key={integration.id} className="border border-slate-200 rounded-lg p-4 bg-slate-50">
<div className="flex items-start gap-3">
<span className="text-2xl">{integration.icon}</span>
<div className="flex-1">
<div className="flex items-center gap-2">
<h3 className="text-sm font-medium text-slate-800">{integration.name}</h3>
<span className="px-1.5 py-0.5 bg-yellow-100 text-yellow-700 rounded text-[10px]">Geplant</span>
</div>
<p className="text-xs text-slate-500 mt-1">{integration.description}</p>
</div>
</div>
</div>
))}
</div>
</div>
)
}

View File

@@ -1,6 +1,6 @@
export const API_BASE = '/api/admin/consent' export const API_BASE = '/api/admin/consent'
export type Tab = 'documents' | 'versions' | 'emails' | 'gdpr' | 'stats' export type Tab = 'documents' | 'versions' | 'emails' | 'gdpr' | 'stats' | 'deadlines' | 'integrations'
export interface Document { export interface Document {
id: string id: string

View File

@@ -25,6 +25,8 @@ import { GdprTab } from './_components/GdprTab'
import { StatsTab } from './_components/StatsTab' import { StatsTab } from './_components/StatsTab'
import { ConsentTemplateCreateModal } from './_components/ConsentTemplateCreateModal' import { ConsentTemplateCreateModal } from './_components/ConsentTemplateCreateModal'
import { EmailTemplateEditModal, EmailTemplatePreviewModal } from './_components/EmailTemplateModals' import { EmailTemplateEditModal, EmailTemplatePreviewModal } from './_components/EmailTemplateModals'
import { DeadlineTab } from './_components/DeadlineTab'
import { IntegrationStubs } from './_components/IntegrationStubs'
export default function ConsentManagementPage() { export default function ConsentManagementPage() {
const { state } = useSDK() const { state } = useSDK()
@@ -55,6 +57,8 @@ export default function ConsentManagementPage() {
{ id: 'emails', label: 'E-Mail Vorlagen' }, { id: 'emails', label: 'E-Mail Vorlagen' },
{ id: 'gdpr', label: 'DSGVO Prozesse' }, { id: 'gdpr', label: 'DSGVO Prozesse' },
{ id: 'stats', label: 'Statistiken' }, { id: 'stats', label: 'Statistiken' },
{ id: 'deadlines', label: 'Fristen' },
{ id: 'integrations', label: 'Integrationen' },
] ]
return ( return (
@@ -162,6 +166,10 @@ export default function ConsentManagementPage() {
)} )}
{activeTab === 'stats' && <StatsTab consentStats={consentStats} />} {activeTab === 'stats' && <StatsTab consentStats={consentStats} />}
{activeTab === 'deadlines' && <DeadlineTab />}
{activeTab === 'integrations' && <IntegrationStubs />}
</div> </div>
</div> </div>

View File

@@ -13,21 +13,22 @@ export function LoadingSpinner() {
) )
} }
export { PublicFormConfig as SettingsTabContent } from './PublicFormConfig'
export function SettingsTab() { export function SettingsTab() {
return ( return (
<div className="bg-white rounded-xl border border-gray-200 p-8 text-center"> <div className="space-y-6">
<div className="w-16 h-16 mx-auto bg-gray-100 rounded-full flex items-center justify-center mb-4"> <div className="bg-white rounded-xl border border-gray-200 p-6">
<svg className="w-8 h-8 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <SettingsTabContent />
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
</div> </div>
<h3 className="text-lg font-semibold text-gray-900">Einstellungen</h3> <div className="bg-white rounded-xl border border-gray-200 p-6">
<p className="mt-2 text-gray-500"> <h3 className="text-base font-semibold text-slate-900 mb-2">Workflow-Konfiguration</h3>
DSR-Portal-Einstellungen, E-Mail-Vorlagen und Workflow-Konfiguration <p className="text-sm text-slate-500">
werden in einer spaeteren Version verfuegbar sein. SLA-Fristen, automatische Zuweisungen und Eskalationsregeln
werden in Production ueber den Core-Service konfiguriert.
</p> </p>
</div> </div>
</div>
) )
} }

View File

@@ -0,0 +1,97 @@
'use client'
import { useState } from 'react'
interface PublicFormSettings {
enabled: boolean
formUrl: string
allowedTypes: string[]
requireIdentity: boolean
customCss: string
}
const DSR_TYPES = [
{ value: 'access', label: 'Auskunft (Art. 15)' },
{ value: 'rectification', label: 'Berichtigung (Art. 16)' },
{ value: 'erasure', label: 'Loeschung (Art. 17)' },
{ value: 'restriction', label: 'Einschraenkung (Art. 18)' },
{ value: 'portability', label: 'Datenportabilitaet (Art. 20)' },
{ value: 'objection', label: 'Widerspruch (Art. 21)' },
]
export function PublicFormConfig() {
const [settings, setSettings] = useState<PublicFormSettings>({
enabled: false,
formUrl: '',
allowedTypes: ['access', 'erasure', 'portability'],
requireIdentity: true,
customCss: '',
})
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<h3 className="text-base font-semibold text-slate-900">Oeffentliches DSR-Formular</h3>
<label className="flex items-center gap-2 cursor-pointer">
<input type="checkbox" checked={settings.enabled}
onChange={e => setSettings({ ...settings, enabled: e.target.checked })}
className="rounded border-gray-300 text-purple-600" />
<span className="text-sm text-slate-600">Aktiviert</span>
</label>
</div>
{!settings.enabled ? (
<div className="bg-gray-50 border border-gray-200 rounded-lg p-4 text-sm text-gray-600">
Das oeffentliche DSR-Formular ermoeglicht Betroffenen, Datenschutzanfragen direkt
ueber Ihre Website einzureichen ohne Anmeldung. Aktivieren Sie es, um den
Embed-Code zu generieren.
</div>
) : (
<div className="space-y-4">
<div>
<label className="block text-sm font-medium text-slate-700 mb-1">Erlaubte Anfragetypen</label>
<div className="grid grid-cols-2 gap-2">
{DSR_TYPES.map(type => (
<label key={type.value} className="flex items-center gap-2 text-sm text-slate-600">
<input type="checkbox"
checked={settings.allowedTypes.includes(type.value)}
onChange={e => {
const types = e.target.checked
? [...settings.allowedTypes, type.value]
: settings.allowedTypes.filter(t => t !== type.value)
setSettings({ ...settings, allowedTypes: types })
}}
className="rounded border-gray-300 text-purple-600" />
{type.label}
</label>
))}
</div>
</div>
<label className="flex items-center gap-2 cursor-pointer">
<input type="checkbox" checked={settings.requireIdentity}
onChange={e => setSettings({ ...settings, requireIdentity: e.target.checked })}
className="rounded border-gray-300 text-purple-600" />
<span className="text-sm text-slate-600">Identitaetsnachweis erforderlich</span>
</label>
<div className="bg-slate-50 border border-slate-200 rounded-lg p-4">
<h4 className="text-sm font-medium text-slate-700 mb-2">Embed-Code</h4>
<pre className="text-xs font-mono bg-white border border-slate-200 rounded p-3 overflow-x-auto">
{`<iframe
src="https://ihre-domain.breakpilot.ai/dsr/public-form"
width="100%"
height="600"
frameborder="0"
title="Datenschutzanfrage"
></iframe>`}
</pre>
<p className="text-xs text-slate-500 mt-2">
Embed-Code wird nach Anbindung an Production generiert.
</p>
</div>
</div>
)}
</div>
)
}