+ );
+}
+
export default function SettingsView() {
const currentUser = useAppStore((s) => s.currentUser);
const [activeTab, setActiveTab] = useState('school');
@@ -1859,6 +2338,10 @@ export default function SettingsView() {
{t('badges.manage')}
+
+
+ {t('dsgvo.tab_privacy')}
+
{/* ── School Info Tab ─────────────────────────────────── */}
@@ -4568,6 +5051,11 @@ export default function SettingsView() {
+
+ {/* ── Datenschutz / Privacy Tab ─────────────────────────────── */}
+
+
+
);
}
diff --git a/src/lib/i18n.ts b/src/lib/i18n.ts
index d705622..53e9ceb 100644
--- a/src/lib/i18n.ts
+++ b/src/lib/i18n.ts
@@ -3416,6 +3416,78 @@ const de: TranslationDict = {
'grading.ausreichend': 'Ausreichend',
'grading.mangelhaft': 'Mangelhaft',
'grading.ungenuegend': 'Ungenügend',
+
+ // DSGVO / Datenschutz
+ 'dsgvo.title': 'Datenschutz',
+ 'dsgvo.privacy_policy': 'Datenschutzerklärung',
+ 'dsgvo.data_processing': 'Datenverarbeitung',
+ 'dsgvo.data_collected': 'Erhobene Daten',
+ 'dsgvo.data_purpose': 'Verarbeitungszweck',
+ 'dsgvo.data_retention': 'Speicherdauer',
+ 'dsgvo.data_third_party': 'Datenweitergabe an Dritte',
+ 'dsgvo.data_portability': 'Datenübertragbarkeit',
+ 'dsgvo.right_access': 'Auskunftsrecht',
+ 'dsgvo.right_rectification': 'Berichtigungsrecht',
+ 'dsgvo.right_erasure': 'Löschrecht',
+ 'dsgvo.right_portability': 'Recht auf Datenübertragbarkeit',
+ 'dsgvo.right_restriction': 'Recht auf Einschränkung der Verarbeitung',
+ 'dsgvo.right_objection': 'Widerspruchsrecht',
+ 'dsgvo.contact_dpo': 'Datenschutzbeauftragter',
+ 'dsgvo.export_data': 'Meine Daten exportieren',
+ 'dsgvo.export_data_desc': 'Exportieren Sie alle Ihre persönlichen Daten im JSON-Format (DSGVO Art. 20)',
+ 'dsgvo.export_data_success': 'Ihre Daten wurden erfolgreich exportiert.',
+ 'dsgvo.export_data_error': 'Fehler beim Exportieren der Daten.',
+ 'dsgvo.delete_account': 'Konto löschen',
+ 'dsgvo.delete_account_desc': 'Löschen Sie Ihr Konto und alle zugehörigen Daten (DSGVO Art. 17)',
+ 'dsgvo.delete_warning': 'Diese Aktion kann nicht rückgängig gemacht werden. Alle Ihre Daten werden nach 30 Tagen unwiderruflich gelöscht.',
+ 'dsgvo.delete_confirm_title': 'Konto wirklich löschen?',
+ 'dsgvo.delete_confirm_desc': 'Geben Sie Ihr Passwort ein, um die Löschung zu bestätigen. Ihr Konto wird in 30 Tagen unwiderruflich gelöscht.',
+ 'dsgvo.delete_password_label': 'Passwort zur Bestätigung',
+ 'dsgvo.delete_success': 'Ihr Konto wurde zur Löschung vorgemerkt. Sie haben 30 Tage Zeit, um den Vorgang abzubrechen.',
+ 'dsgvo.delete_error': 'Fehler beim Löschen des Kontos.',
+ 'dsgvo.delete_wrong_password': 'Falsches Passwort.',
+ 'dsgvo.delete_cancel_success': 'Die Löschung wurde abgebrochen.',
+ 'dsgvo.delete_scheduled': 'Löschung geplant am',
+ 'dsgvo.delete_cancel': 'Löschung abbrechen',
+ 'dsgvo.cookie_consent': 'Wir verwenden Cookies, um Ihnen die bestmögliche Erfahrung zu bieten.',
+ 'dsgvo.cookie_essential': 'Essenzielle Cookies',
+ 'dsgvo.cookie_essential_desc': 'Diese Cookies sind für die Funktionalität der Plattform erforderlich.',
+ 'dsgvo.cookie_analytics': 'Analyse-Cookies',
+ 'dsgvo.cookie_analytics_desc': 'Diese Cookies helfen uns, die Plattform zu verbessern.',
+ 'dsgvo.cookie_accept': 'Alle akzeptieren',
+ 'dsgvo.cookie_reject': 'Nur essenzielle',
+ 'dsgvo.cookie_settings': 'Cookie-Einstellungen',
+ 'dsgvo.jugendschutz': 'Jugendschutz',
+ 'dsgvo.jugendschutz_notice': 'Diese Plattform ist für Schülerinnen und Schüler unter 16 Jahren nur mit Zustimmung der Erziehungsberechtigten nutzbar.',
+ 'dsgvo.parental_consent': 'Einverständnis der Erziehungsberechtigten',
+ 'dsgvo.no_advertising': 'Keine Werbung für Schüler',
+ 'dsgvo.no_tracking': 'Kein Tracking von Schülern unter 16 Jahren',
+ 'dsgvo.dpa': 'Auftragsverarbeitungsvertrag (AVV)',
+ 'dsgvo.dpa_desc': 'Vertrag zur Auftragsdatenverarbeitung gemäß Art. 28 DSGVO',
+ 'dsgvo.data_register': 'Verzeichnis von Verarbeitungstätigkeiten',
+ 'dsgvo.data_register_desc': 'Übersicht aller Verarbeitungstätigkeiten gemäß Art. 30 DSGVO',
+ 'dsgvo.privacy_policy_text': 'Die nachfolgende Datenschutzerklärung gilt für die Nutzung der Plattform CompetenceTrack. Verantwortlich für die Datenverarbeitung ist die jeweilige Schule.',
+ 'dsgvo.data_collected_list': 'Name, E-Mail-Adresse, Passwort (verschlüsselt), Rollenzuordnung, Klassen- und Fächerverknüpfungen, Lernfortschritte, Bewertungen, Anwesenheitsdaten, Notizen und Zeugnisse.',
+ 'dsgvo.data_purpose_list': 'Bereitstellung und Betrieb der Plattform, Verwaltung von Schülern und Klassen, Dokumentation von Lernfortschritten, Erstellung von Zeugnissen und Berichten, Kommunikation mit Eltern.',
+ 'dsgvo.data_retention_list': 'Nutzerdaten werden für die Dauer der Nutzung gespeichert. Nach Löschung des Kontos werden die Daten nach Ablauf der 30-tägigen Widerspruchsfrist unwiderruflich gelöscht. Auswertungsdaten werden nach 3 Jahren anonymisiert.',
+ 'dsgvo.data_third_party_list': 'Es erfolgt keine Weitergabe personenbezogener Daten an Dritte, soweit keine gesetzliche Verpflichtung besteht oder die Datenverarbeitung im Auftrag gemäß Art. 28 DSGVO erfolgt.',
+ 'dsgvo.dpa_template_text': 'Der Auftragsverarbeitungsvertrag (AVV) regelt die Datenverarbeitung im Auftrag gemäß Art. 28 DSGVO. Die Schule als Verantwortliche schließt diesen Vertrag mit dem Betreiber der Plattform ab.',
+ 'dsgvo.dpa_status_signed': 'Unterzeichnet',
+ 'dsgvo.dpa_status_pending': 'Ausstehend',
+ 'dsgvo.dpa_sign': 'AVV unterzeichnen',
+ 'dsgvo.jugendschutz_login_notice': 'Für Schüler unter 16 Jahren ist die Nutzung nur mit Zustimmung der Erziehungsberechtigten erlaubt.',
+ 'dsgvo.jugendschutz_rewards': 'Wettbewerbspreise entsprechen den Anforderungen des Jugendschutzgesetzes.',
+ 'dsgvo.tab_privacy': 'Datenschutz',
+ 'dsgvo.rights_title': 'Ihre Rechte nach DSGVO',
+ 'dsgvo.rights_desc': 'Sie haben gegenüber dem Verantwortlichen folgende Rechte:',
+ 'dsgvo.right_access_desc': 'Sie haben das Recht, Auskunft darüber zu verlangen, welche personenbezogenen Daten über Sie verarbeitet werden.',
+ 'dsgvo.right_rectification_desc': 'Sie haben das Recht, die Berichtigung unrichtiger personenbezogener Daten zu verlangen.',
+ 'dsgvo.right_erasure_desc': 'Sie haben das Recht, die Löschung Ihrer personenbezogenen Daten zu verlangen.',
+ 'dsgvo.right_portability_desc': 'Sie haben das Recht, Ihre Daten in einem strukturierten, gängigen und maschinenlesbaren Format zu erhalten.',
+ 'dsgvo.right_restriction_desc': 'Sie haben das Recht, die Einschränkung der Verarbeitung Ihrer Daten zu verlangen.',
+ 'dsgvo.right_objection_desc': 'Sie haben das Recht, aus Gründen der besonderen Situation Widerspruch gegen die Verarbeitung einzulegen.',
+ 'dsgvo.dpa_download': 'AVV-Vorlage herunterladen',
+ 'dsgvo.data_register_download': 'Verzeichnis herunterladen',
};
const en: TranslationDict = {
@@ -6831,6 +6903,78 @@ const en: TranslationDict = {
'grading.ausreichend': 'Ausreichend',
'grading.mangelhaft': 'Mangelhaft',
'grading.ungenuegend': 'Ungenügend',
+
+ // DSGVO / Privacy
+ 'dsgvo.title': 'Privacy',
+ 'dsgvo.privacy_policy': 'Privacy Policy',
+ 'dsgvo.data_processing': 'Data Processing',
+ 'dsgvo.data_collected': 'Data Collected',
+ 'dsgvo.data_purpose': 'Purpose of Processing',
+ 'dsgvo.data_retention': 'Retention Period',
+ 'dsgvo.data_third_party': 'Third-Party Data Sharing',
+ 'dsgvo.data_portability': 'Data Portability',
+ 'dsgvo.right_access': 'Right of Access',
+ 'dsgvo.right_rectification': 'Right to Rectification',
+ 'dsgvo.right_erasure': 'Right to Erasure',
+ 'dsgvo.right_portability': 'Right to Data Portability',
+ 'dsgvo.right_restriction': 'Right to Restriction of Processing',
+ 'dsgvo.right_objection': 'Right to Object',
+ 'dsgvo.contact_dpo': 'Data Protection Officer',
+ 'dsgvo.export_data': 'Export My Data',
+ 'dsgvo.export_data_desc': 'Export all your personal data in JSON format (GDPR Art. 20)',
+ 'dsgvo.export_data_success': 'Your data has been successfully exported.',
+ 'dsgvo.export_data_error': 'Error exporting data.',
+ 'dsgvo.delete_account': 'Delete Account',
+ 'dsgvo.delete_account_desc': 'Delete your account and all associated data (GDPR Art. 17)',
+ 'dsgvo.delete_warning': 'This action cannot be undone. All your data will be permanently deleted after 30 days.',
+ 'dsgvo.delete_confirm_title': 'Really delete account?',
+ 'dsgvo.delete_confirm_desc': 'Enter your password to confirm deletion. Your account will be permanently deleted in 30 days.',
+ 'dsgvo.delete_password_label': 'Password to confirm',
+ 'dsgvo.delete_success': 'Your account has been scheduled for deletion. You have 30 days to cancel.',
+ 'dsgvo.delete_error': 'Error deleting account.',
+ 'dsgvo.delete_wrong_password': 'Wrong password.',
+ 'dsgvo.delete_cancel_success': 'Deletion has been cancelled.',
+ 'dsgvo.delete_scheduled': 'Deletion scheduled on',
+ 'dsgvo.delete_cancel': 'Cancel deletion',
+ 'dsgvo.cookie_consent': 'We use cookies to provide you with the best possible experience.',
+ 'dsgvo.cookie_essential': 'Essential Cookies',
+ 'dsgvo.cookie_essential_desc': 'These cookies are required for the platform to function.',
+ 'dsgvo.cookie_analytics': 'Analytics Cookies',
+ 'dsgvo.cookie_analytics_desc': 'These cookies help us improve the platform.',
+ 'dsgvo.cookie_accept': 'Accept All',
+ 'dsgvo.cookie_reject': 'Essential Only',
+ 'dsgvo.cookie_settings': 'Cookie Settings',
+ 'dsgvo.jugendschutz': 'Youth Protection',
+ 'dsgvo.jugendschutz_notice': 'This platform may only be used by students under 16 with the consent of their legal guardians.',
+ 'dsgvo.parental_consent': 'Parental Consent',
+ 'dsgvo.no_advertising': 'No advertising for students',
+ 'dsgvo.no_tracking': 'No tracking of students under 16',
+ 'dsgvo.dpa': 'Data Processing Agreement (DPA)',
+ 'dsgvo.dpa_desc': 'Data processing agreement pursuant to Art. 28 GDPR',
+ 'dsgvo.data_register': 'Register of Processing Activities',
+ 'dsgvo.data_register_desc': 'Overview of all processing activities pursuant to Art. 30 GDPR',
+ 'dsgvo.privacy_policy_text': 'The following privacy policy applies to the use of the CompetenceTrack platform. The respective school is responsible for data processing.',
+ 'dsgvo.data_collected_list': 'Name, email address, password (encrypted), role assignment, class and subject associations, learning progress, assessments, attendance data, notes and reports.',
+ 'dsgvo.data_purpose_list': 'Provision and operation of the platform, management of students and classes, documentation of learning progress, creation of reports, communication with parents.',
+ 'dsgvo.data_retention_list': 'User data is stored for the duration of use. After account deletion, data is permanently deleted after the 30-day objection period. Analytics data is anonymized after 3 years.',
+ 'dsgvo.data_third_party_list': 'Personal data is not shared with third parties unless required by law or processed on behalf pursuant to Art. 28 GDPR.',
+ 'dsgvo.dpa_template_text': 'The Data Processing Agreement (DPA) regulates data processing on behalf pursuant to Art. 28 GDPR. The school as controller concludes this agreement with the platform operator.',
+ 'dsgvo.dpa_status_signed': 'Signed',
+ 'dsgvo.dpa_status_pending': 'Pending',
+ 'dsgvo.dpa_sign': 'Sign DPA',
+ 'dsgvo.jugendschutz_login_notice': 'Students under 16 may only use this platform with the consent of their legal guardians.',
+ 'dsgvo.jugendschutz_rewards': 'Competition prizes comply with the Youth Protection Act requirements.',
+ 'dsgvo.tab_privacy': 'Privacy',
+ 'dsgvo.rights_title': 'Your Rights under GDPR',
+ 'dsgvo.rights_desc': 'You have the following rights vis-à-vis the controller:',
+ 'dsgvo.right_access_desc': 'You have the right to request information about which personal data is processed about you.',
+ 'dsgvo.right_rectification_desc': 'You have the right to request the correction of inaccurate personal data.',
+ 'dsgvo.right_erasure_desc': 'You have the right to request the deletion of your personal data.',
+ 'dsgvo.right_portability_desc': 'You have the right to receive your data in a structured, commonly used, and machine-readable format.',
+ 'dsgvo.right_restriction_desc': 'You have the right to request the restriction of processing of your data.',
+ 'dsgvo.right_objection_desc': 'You have the right to object to processing on grounds relating to your particular situation.',
+ 'dsgvo.dpa_download': 'Download DPA template',
+ 'dsgvo.data_register_download': 'Download register',
};
const translations: Record = { de, en };
diff --git a/worklog.md b/worklog.md
index 8e3f97c..b5bd35a 100644
--- a/worklog.md
+++ b/worklog.md
@@ -1504,3 +1504,61 @@ Work Log:
- `Trophy` is already imported in `app-layout.tsx`
- **Lint**: All checks pass (`bun run lint` — no errors)
+
+---
+Task ID: 5
+Agent: dsgvo-compliance
+Task: Add DSGVO (German GDPR) Compliance Features to CompetenceTrack
+Date: 2025-01-28
+
+Work Log:
+- **i18n keys** (`src/lib/i18n.ts`):
+ - Added 65+ DSGVO/privacy translation keys in both German (DE) and English (EN)
+ - Covers: privacy policy, data processing, user rights (Auskunftsrecht, Berichtigungsrecht, Löschrecht, etc.), cookie consent, Jugendschutz, DPA/AVV, data export, account deletion
+ - All German legal terms are accurate (DSGVO, Jugendschutzgesetz, TTDSG, AVV, Art. 28/30 DSGVO)
+
+- **Cookie Consent Component** (`src/components/cookie-consent.tsx`):
+ - Bottom-fixed banner with emerald accent that appears on first visit
+ - Essential cookies (always on) and Analytics cookies (optional) with toggle
+ - "Alle akzeptieren" and "Nur essenzielle" buttons
+ - "Cookie-Einstellungen" expandable details panel
+ - Stores consent in localStorage with key `ct_cookie_consent`
+ - Exports `hasAnalyticsConsent()` and `hasCookieConsent()` helper functions
+ - Animated with framer-motion, professional design with emerald/amber accents
+
+- **GDPR Data Export API** (`src/app/api/gdpr-export/route.ts`):
+ - GET endpoint that exports all user data as JSON (DSGVO Art. 20)
+ - Uses `getSession()` for authentication
+ - Exports: user profile, school info, class associations, learning progress, assessments, reports, audit logs, data export requests, teacher notes, attendance sessions, notifications, notebooks, homework
+ - For students: also exports student data, enrollments, progress entries, assessment results
+ - For parents: also exports parent-student links
+ - Returns JSON with Content-Disposition header for download
+ - Includes export metadata with legal basis reference
+
+- **Account Deletion API** (`src/app/api/account-deletion/route.ts`):
+ - POST: Soft delete (sets `deletedAt`) with 30-day grace period (DSGVO Art. 17)
+ - Requires password confirmation via body `{ password: string }`
+ - PUT: Cancel deletion within grace period (clears `deletedAt`)
+ - GET: Check deletion status (scheduled date, canCancel flag)
+ - Creates audit log entries for both request and cancellation
+ - Uses `verifyPassword()` for secure confirmation
+
+- **Privacy Tab in Settings** (`src/components/settings-view.tsx`):
+ - Added "Datenschutz" (Privacy) tab with Shield icon
+ - Privacy Policy Card: data processing notice, data collected, purpose, retention, third-party sharing, DPO contact
+ - User Rights Card: 6 DSGVO rights in a 2-column grid with colored icons (Auskunftsrecht, Berichtigungsrecht, Löschrecht, Datenübertragbarkeit, Einschränkung, Widerspruchsrecht)
+ - Data Export Card: "Meine Daten exportieren" button with JSON download (DSGVO Art. 20)
+ - Account Deletion Card: "Konto löschen" button with confirmation dialog requiring password, 30-day grace period display, cancel option (DSGVO Art. 17)
+ - Jugendschutz Card: parental consent notice, no advertising, no tracking under 16, Jugendschutzgesetz-compliant rewards
+ - DPA/AVV Card (admin only): Auftragsverarbeitungsvertrag template download, Verzeichnis von Verarbeitungstätigkeiten (Art. 30 DSGVO) download, DPA status badge
+
+- **Cookie Consent on Main Page** (`src/app/page.tsx`):
+ - Imported and rendered `CookieConsent` component
+ - Shows on both authenticated and unauthenticated views
+
+- **Jugendschutz Notice in Auth** (`src/components/auth-view.tsx`):
+ - Added youth protection notice for student login: "Für Schüler unter 16 Jahren ist die Nutzung nur mit Zustimmung der Erziehungsberechtigten erlaubt."
+ - Displays with Shield icon and emerald styling below the existing student info section
+
+- **Lint**: All checks pass (`npx eslint` — no errors on any modified file)
+- **Dev Server**: Compiles successfully, no errors in dev.log