feat(compliance): P-06 Upload-Einwilligungsdialog v1-conservative
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / playwright-tests (push) Failing after 1m23s
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / playwright-tests (push) Failing after 1m23s
Implementiert server-seitige Rechteerklärungspflicht für alle Medien-Uploads
und Sichtbarkeits-Promotions (konservative Erstannahme: alle Uploads).
Backend:
- backend/media_rights.py (NEU): Kernmodul — validate_rights_declaration,
check_rights_coverage, assert_rights_for_promotion, assert_rights_for_exercise_link,
write_rights_declaration, update_rights_quick_fields
- backend/migrations/048_media_rights_declarations.sql (NEU): Tabelle
media_asset_rights_declarations (Append-only Audit-Log), Felder
rights_status/rights_visibility_level in media_assets
- backend/routers/media_assets.py: P-06-Pflichtprüfung in PATCH (single + bulk),
POST /api/media-assets/{id}/rights-declarations (Re-Deklaration),
GET /api/admin/media-rights/legacy-summary|legacy-assets (Admin-Endpoints)
- backend/routers/exercises.py: P-06-Felder in upload_exercise_media,
assert_rights_for_exercise_link in attach_exercise_media_from_asset
- backend/main.py: admin_rights_router registriert
Frontend:
- frontend/src/components/RightsDeclarationDialog.jsx (NEU): 9-Felder-Dialog
(konservativ: immer alle Fragen), Client-Validierung, VORLÄUFIG-Hinweis
- frontend/src/pages/MediaLibraryPage.jsx: Dialog-Intercept vor Upload,
Altbestand-Indikator (legacy_unreviewed)
- frontend/src/utils/api.js: P-06-Felder in bulkUploadMediaAssets weitergeleitet
Tests:
- backend/tests/test_media_rights_declaration.py (NEU): 28 Unit-/Integrationstests
- backend/tests/test_media_assets_archive.py: P-06 fetchone-Slots + Mock ergänzt
- backend/tests/test_media_assets_copyright_promotion.py: check_rights_coverage gemockt
- tests/dev-smoke-test.spec.js: 5 P-06 E2E-Tests ergänzt
Dokumentation:
- docs/compliance-implementation.md: P-06-Abschnitt
- docs/compliance-package-register.md: Status ⚠️ teilweise umgesetzt (KRIT-04 offen)
- docs/compliance-roadmap.md: P-06 im Freigaben-Log
Offen: KRIT-04 (rechtliche Finalisierung Einwilligungsformulierung) — technisch
vollständig, Rechtstext VORLÄUFIG.
version: 0.8.75
module: media_rights 1.0.0, media_assets 1.13.0, exercises 2.20.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
8cda5c27ec
commit
34235ef46d
18 files changed
+1829
-41
No files matched your search
@@ -0,0 +1,240 @@
|
||||
/**
|
||||
* P-06: Einwilligungsdialog vor Medien-Uploads und Sichtbarkeits-Promotionen.
|
||||
* VORLÄUFIG – Texte noch nicht juristisch geprüft (p06-v1-conservative).
|
||||
*/
|
||||
import React, { useState } from 'react'
|
||||
|
||||
const INITIAL = {
|
||||
rights_holder_confirmed: false,
|
||||
contains_identifiable_persons: null,
|
||||
person_consent_confirmed: false,
|
||||
contains_minors: null,
|
||||
parental_consent_confirmed: false,
|
||||
contains_music: null,
|
||||
music_rights_confirmed: false,
|
||||
contains_third_party_content: null,
|
||||
third_party_rights_confirmed: false,
|
||||
}
|
||||
|
||||
function resetDecl() {
|
||||
return { ...INITIAL }
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} props
|
||||
* @param {boolean} props.open
|
||||
* @param {function} props.onCancel
|
||||
* @param {function(decl: object): void} props.onConfirm
|
||||
* @param {string} [props.targetVisibility] - 'private'|'club'|'official'
|
||||
* @param {boolean} [props.isPromotion] - true wenn Promotion (nicht Erstupload)
|
||||
* @param {string} [props.mode] - 'upload'|'promotion'|'redeclaration'
|
||||
*/
|
||||
export default function RightsDeclarationDialog({
|
||||
open,
|
||||
onCancel,
|
||||
onConfirm,
|
||||
targetVisibility = 'private',
|
||||
isPromotion = false,
|
||||
mode = 'upload',
|
||||
}) {
|
||||
const [decl, setDecl] = useState(resetDecl)
|
||||
const [error, setError] = useState('')
|
||||
|
||||
if (!open) return null
|
||||
|
||||
const setField = (key, val) => setDecl((d) => ({ ...d, [key]: val }))
|
||||
|
||||
const validate = () => {
|
||||
if (!decl.rights_holder_confirmed)
|
||||
return 'Bitte bestätigen, dass du die erforderlichen Rechte an diesem Medium besitzt.'
|
||||
if (decl.contains_identifiable_persons === null)
|
||||
return 'Bitte angeben, ob erkennbare Personen abgebildet sind.'
|
||||
if (decl.contains_identifiable_persons && !decl.person_consent_confirmed)
|
||||
return 'Bitte bestätigen, dass die Einwilligungen aller erkennbaren Personen vorliegen.'
|
||||
if (decl.contains_minors === null)
|
||||
return 'Bitte angeben, ob Minderjährige abgebildet sind.'
|
||||
if (decl.contains_minors && !decl.parental_consent_confirmed)
|
||||
return 'Bitte bestätigen, dass die Einwilligungen der Sorgeberechtigten vorliegen.'
|
||||
if (decl.contains_music === null)
|
||||
return 'Bitte angeben, ob das Medium Musik enthält.'
|
||||
if (decl.contains_music && !decl.music_rights_confirmed)
|
||||
return 'Bitte bestätigen, dass die erforderlichen Musikrechte vorliegen.'
|
||||
if (decl.contains_third_party_content === null)
|
||||
return 'Bitte angeben, ob fremde geschützte Inhalte (Logos, Grafiken etc.) enthalten sind.'
|
||||
if (decl.contains_third_party_content && !decl.third_party_rights_confirmed)
|
||||
return 'Bitte bestätigen, dass die Rechte an allen enthaltenen Fremdmaterialien vorliegen.'
|
||||
return ''
|
||||
}
|
||||
|
||||
const handleConfirm = () => {
|
||||
const err = validate()
|
||||
if (err) { setError(err); return }
|
||||
setError('')
|
||||
onConfirm({ ...decl })
|
||||
setDecl(resetDecl())
|
||||
}
|
||||
|
||||
const handleCancel = () => {
|
||||
setDecl(resetDecl())
|
||||
setError('')
|
||||
onCancel()
|
||||
}
|
||||
|
||||
const visLabel = { private: 'privat', club: 'Verein', official: 'offiziell' }[targetVisibility] || targetVisibility
|
||||
|
||||
const titleMap = {
|
||||
upload: 'Rechte-Erklärung – Upload',
|
||||
promotion: `Rechte-Erklärung – Freigabe für „${visLabel}"`,
|
||||
redeclaration: 'Rechte-Erklärung – Nachdeklaration',
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="modal-overlay" role="dialog" aria-modal="true" aria-label="Rechte-Erklärung">
|
||||
<div className="modal-content" style={{ maxWidth: 560 }}>
|
||||
<h2 style={{ marginBottom: 4 }}>{titleMap[mode] || titleMap.upload}</h2>
|
||||
<p style={{ fontSize: '0.85rem', color: 'var(--text2)', marginBottom: 16 }}>
|
||||
VORLÄUFIG – Texte noch nicht juristisch geprüft (p06-v1-conservative).
|
||||
{isPromotion && (
|
||||
<> Die bestehende Erklärung gilt nicht für die Sichtbarkeit „{visLabel}". Bitte erneut bestätigen.</>
|
||||
)}
|
||||
</p>
|
||||
|
||||
{/* T1 */}
|
||||
<div className="form-row" style={{ display: 'flex', alignItems: 'flex-start', gap: 10 }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="rhc"
|
||||
checked={decl.rights_holder_confirmed}
|
||||
onChange={(e) => setField('rights_holder_confirmed', e.target.checked)}
|
||||
style={{ marginTop: 3, flexShrink: 0 }}
|
||||
/>
|
||||
<label htmlFor="rhc" style={{ fontSize: '0.9rem' }}>
|
||||
Ich bestätige, dass ich die erforderlichen Urheber- und Nutzungsrechte an diesem Medium besitze
|
||||
oder rechtmäßig zur Veröffentlichung berechtigt bin. *
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{/* T2 / T3 */}
|
||||
<fieldset style={{ border: 'none', padding: 0, marginTop: 14 }}>
|
||||
<legend style={{ fontSize: '0.9rem', fontWeight: 600, marginBottom: 6 }}>
|
||||
Sind erkennbare Personen abgebildet? *
|
||||
</legend>
|
||||
<div style={{ display: 'flex', gap: 16 }}>
|
||||
<label style={{ fontSize: '0.9rem' }}>
|
||||
<input type="radio" name="cip" checked={decl.contains_identifiable_persons === true}
|
||||
onChange={() => setField('contains_identifiable_persons', true)} /> Ja
|
||||
</label>
|
||||
<label style={{ fontSize: '0.9rem' }}>
|
||||
<input type="radio" name="cip" checked={decl.contains_identifiable_persons === false}
|
||||
onChange={() => setField('contains_identifiable_persons', false)} /> Nein
|
||||
</label>
|
||||
</div>
|
||||
{decl.contains_identifiable_persons === true && (
|
||||
<div className="form-row" style={{ display: 'flex', alignItems: 'flex-start', gap: 10, marginTop: 8 }}>
|
||||
<input type="checkbox" id="pcc" checked={decl.person_consent_confirmed}
|
||||
onChange={(e) => setField('person_consent_confirmed', e.target.checked)}
|
||||
style={{ marginTop: 3, flexShrink: 0 }} />
|
||||
<label htmlFor="pcc" style={{ fontSize: '0.9rem' }}>
|
||||
Ich bestätige, dass die Einwilligungen aller erkennbaren Personen zur Abbildung vorliegen. *
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
</fieldset>
|
||||
|
||||
{/* T4 / T5 */}
|
||||
<fieldset style={{ border: 'none', padding: 0, marginTop: 14 }}>
|
||||
<legend style={{ fontSize: '0.9rem', fontWeight: 600, marginBottom: 6 }}>
|
||||
Sind Minderjährige abgebildet? *
|
||||
</legend>
|
||||
<div style={{ display: 'flex', gap: 16 }}>
|
||||
<label style={{ fontSize: '0.9rem' }}>
|
||||
<input type="radio" name="cm" checked={decl.contains_minors === true}
|
||||
onChange={() => setField('contains_minors', true)} /> Ja
|
||||
</label>
|
||||
<label style={{ fontSize: '0.9rem' }}>
|
||||
<input type="radio" name="cm" checked={decl.contains_minors === false}
|
||||
onChange={() => setField('contains_minors', false)} /> Nein
|
||||
</label>
|
||||
</div>
|
||||
{decl.contains_minors === true && (
|
||||
<div className="form-row" style={{ display: 'flex', alignItems: 'flex-start', gap: 10, marginTop: 8 }}>
|
||||
<input type="checkbox" id="pcc2" checked={decl.parental_consent_confirmed}
|
||||
onChange={(e) => setField('parental_consent_confirmed', e.target.checked)}
|
||||
style={{ marginTop: 3, flexShrink: 0 }} />
|
||||
<label htmlFor="pcc2" style={{ fontSize: '0.9rem' }}>
|
||||
Ich bestätige, dass die Einwilligungen der Sorgeberechtigten vorliegen. *
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
</fieldset>
|
||||
|
||||
{/* T6 / T7 */}
|
||||
<fieldset style={{ border: 'none', padding: 0, marginTop: 14 }}>
|
||||
<legend style={{ fontSize: '0.9rem', fontWeight: 600, marginBottom: 6 }}>
|
||||
Enthält das Medium Musik? *
|
||||
</legend>
|
||||
<div style={{ display: 'flex', gap: 16 }}>
|
||||
<label style={{ fontSize: '0.9rem' }}>
|
||||
<input type="radio" name="cmu" checked={decl.contains_music === true}
|
||||
onChange={() => setField('contains_music', true)} /> Ja
|
||||
</label>
|
||||
<label style={{ fontSize: '0.9rem' }}>
|
||||
<input type="radio" name="cmu" checked={decl.contains_music === false}
|
||||
onChange={() => setField('contains_music', false)} /> Nein
|
||||
</label>
|
||||
</div>
|
||||
{decl.contains_music === true && (
|
||||
<div className="form-row" style={{ display: 'flex', alignItems: 'flex-start', gap: 10, marginTop: 8 }}>
|
||||
<input type="checkbox" id="mrc" checked={decl.music_rights_confirmed}
|
||||
onChange={(e) => setField('music_rights_confirmed', e.target.checked)}
|
||||
style={{ marginTop: 3, flexShrink: 0 }} />
|
||||
<label htmlFor="mrc" style={{ fontSize: '0.9rem' }}>
|
||||
Ich bestätige, dass die erforderlichen Musikrechte (GEMA / Lizenz) vorliegen. *
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
</fieldset>
|
||||
|
||||
{/* T8 / T9 */}
|
||||
<fieldset style={{ border: 'none', padding: 0, marginTop: 14 }}>
|
||||
<legend style={{ fontSize: '0.9rem', fontWeight: 600, marginBottom: 6 }}>
|
||||
Enthält das Medium fremde geschützte Inhalte (Logos, Grafiken, Fotos Dritter)? *
|
||||
</legend>
|
||||
<div style={{ display: 'flex', gap: 16 }}>
|
||||
<label style={{ fontSize: '0.9rem' }}>
|
||||
<input type="radio" name="ctpc" checked={decl.contains_third_party_content === true}
|
||||
onChange={() => setField('contains_third_party_content', true)} /> Ja
|
||||
</label>
|
||||
<label style={{ fontSize: '0.9rem' }}>
|
||||
<input type="radio" name="ctpc" checked={decl.contains_third_party_content === false}
|
||||
onChange={() => setField('contains_third_party_content', false)} /> Nein
|
||||
</label>
|
||||
</div>
|
||||
{decl.contains_third_party_content === true && (
|
||||
<div className="form-row" style={{ display: 'flex', alignItems: 'flex-start', gap: 10, marginTop: 8 }}>
|
||||
<input type="checkbox" id="tprc" checked={decl.third_party_rights_confirmed}
|
||||
onChange={(e) => setField('third_party_rights_confirmed', e.target.checked)}
|
||||
style={{ marginTop: 3, flexShrink: 0 }} />
|
||||
<label htmlFor="tprc" style={{ fontSize: '0.9rem' }}>
|
||||
Ich bestätige, dass die Rechte an allen enthaltenen Fremdmaterialien vorliegen. *
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
</fieldset>
|
||||
|
||||
{error && (
|
||||
<p style={{ color: 'var(--danger)', fontSize: '0.85rem', marginTop: 12 }}>{error}</p>
|
||||
)}
|
||||
|
||||
<div style={{ display: 'flex', gap: 10, marginTop: 20, justifyContent: 'flex-end' }}>
|
||||
<button className="btn btn-secondary" type="button" onClick={handleCancel}>
|
||||
Abbrechen
|
||||
</button>
|
||||
<button className="btn btn-primary" type="button" onClick={handleConfirm}>
|
||||
Bestätigen & fortfahren
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import { useAuth } from '../context/AuthContext'
|
||||
import api from '../utils/api'
|
||||
import { activeClubMemberships } from '../utils/activeClub'
|
||||
import { resolveMediaAssetFileUrl } from '../utils/exerciseMediaUrl'
|
||||
import RightsDeclarationDialog from '../components/RightsDeclarationDialog'
|
||||
|
||||
const LC_OPTIONS = [
|
||||
{ value: 'active', label: 'Aktiv' },
|
||||
@@ -268,6 +269,9 @@ export default function MediaLibraryPage() {
|
||||
const [uploadClubId, setUploadClubId] = useState('')
|
||||
const [uploadBusy, setUploadBusy] = useState(false)
|
||||
const [uploadSummary, setUploadSummary] = useState('')
|
||||
// P-06: Rechte-Dialog
|
||||
const [rightsDialogOpen, setRightsDialogOpen] = useState(false)
|
||||
const [pendingUploadFiles, setPendingUploadFiles] = useState(null)
|
||||
const mediaListFetchSeqRef = useRef(0)
|
||||
const gridTopAnchorRef = useRef(null)
|
||||
|
||||
@@ -498,19 +502,29 @@ export default function MediaLibraryPage() {
|
||||
|
||||
const selCount = selected.size
|
||||
|
||||
const onBulkArchiveFiles = async (e) => {
|
||||
const onBulkArchiveFiles = (e) => {
|
||||
const fl = e.target.files
|
||||
if (!fl?.length) return
|
||||
const list = Array.from(fl)
|
||||
e.target.value = ''
|
||||
if (uploadVis === 'club' && !Number(uploadClubId)) {
|
||||
window.alert('Bitte einen Verein für die Sichtbarkeit „Verein“ wählen.')
|
||||
window.alert('Bitte einen Verein für die Sichtbarkeit „Verein” wählen.')
|
||||
return
|
||||
}
|
||||
if (uploadVis === 'private' && isPlatformAdmin && !Number(uploadClubId)) {
|
||||
window.alert('Als Plattform-Admin: Bitte den Zielverein für private Archiv-Uploads wählen (club_id).')
|
||||
return
|
||||
}
|
||||
// P-06: Rechte-Dialog vor Upload anzeigen
|
||||
setPendingUploadFiles(list)
|
||||
setRightsDialogOpen(true)
|
||||
}
|
||||
|
||||
const doUploadWithDecl = async (decl) => {
|
||||
setRightsDialogOpen(false)
|
||||
const list = pendingUploadFiles
|
||||
setPendingUploadFiles(null)
|
||||
if (!list?.length) return
|
||||
setUploadBusy(true)
|
||||
setUploadSummary('')
|
||||
try {
|
||||
@@ -519,6 +533,7 @@ export default function MediaLibraryPage() {
|
||||
...((uploadVis === 'club' || (uploadVis === 'private' && isPlatformAdmin)) && Number(uploadClubId)
|
||||
? { club_id: Number(uploadClubId) }
|
||||
: {}),
|
||||
...decl,
|
||||
})
|
||||
setUploadSummary(
|
||||
`Archiv-Upload: neu ${res.created_count}, bereits vorhanden ${res.duplicate_count}, fehlgeschlagen ${res.failed_count}. Liste aktualisiert.`,
|
||||
@@ -539,6 +554,13 @@ export default function MediaLibraryPage() {
|
||||
|
||||
return (
|
||||
<div className="app-page media-library">
|
||||
<RightsDeclarationDialog
|
||||
open={rightsDialogOpen}
|
||||
onCancel={() => { setRightsDialogOpen(false); setPendingUploadFiles(null) }}
|
||||
onConfirm={doUploadWithDecl}
|
||||
targetVisibility={uploadVis}
|
||||
mode="upload"
|
||||
/>
|
||||
<div className="media-library__container">
|
||||
<header className="media-library__hero">
|
||||
<div className="media-library__hero-row">
|
||||
@@ -778,6 +800,12 @@ export default function MediaLibraryPage() {
|
||||
</div>
|
||||
<div className="media-library__card-footer-row">
|
||||
<MediaCardScopeStatus visibility={it.visibility} lifecycleState={it.lifecycle_state} />
|
||||
{it.rights_status === 'legacy_unreviewed' && (
|
||||
<span
|
||||
style={{ fontSize: '0.7rem', color: 'var(--danger)', marginLeft: 4 }}
|
||||
title="Altbestand – Rechtserklärung nach neuem Standard (P-06) noch nicht erfasst"
|
||||
>Altbestand ⚠</span>
|
||||
)}
|
||||
</div>
|
||||
{(it.tags || []).length ? (
|
||||
<div className="media-library__tag-chips">
|
||||
|
||||
@@ -615,6 +615,21 @@ export async function bulkUploadMediaAssets(files, options = {}) {
|
||||
if (options.club_id != null && options.club_id !== '') {
|
||||
formData.append('club_id', String(options.club_id))
|
||||
}
|
||||
// P-06: Rechte-Erklaerung
|
||||
const p06Fields = [
|
||||
'rights_holder_confirmed',
|
||||
'contains_identifiable_persons',
|
||||
'person_consent_confirmed',
|
||||
'contains_minors',
|
||||
'parental_consent_confirmed',
|
||||
'contains_music',
|
||||
'music_rights_confirmed',
|
||||
'contains_third_party_content',
|
||||
'third_party_rights_confirmed',
|
||||
]
|
||||
for (const f of p06Fields) {
|
||||
if (options[f] != null) formData.append(f, String(options[f]))
|
||||
}
|
||||
const arr = Array.isArray(files) ? files : [files]
|
||||
for (const f of arr) {
|
||||
if (f) formData.append('files', f)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Shinkan Jinkendo Frontend Version
|
||||
|
||||
export const APP_VERSION = "0.8.74"
|
||||
export const BUILD_DATE = "2026-05-10"
|
||||
export const APP_VERSION = "0.8.75"
|
||||
export const BUILD_DATE = "2026-05-11"
|
||||
|
||||
export const PAGE_VERSIONS = {
|
||||
LoginPage: "1.0.2",
|
||||
@@ -10,7 +10,7 @@ export const PAGE_VERSIONS = {
|
||||
LegalPage: "1.3.0",
|
||||
Dashboard: "1.0.0",
|
||||
AccountSettingsPage: "1.0.1",
|
||||
ExercisesPage: "1.5.0", // Fokus +/- Regeln, nur ohne Fokusbereich; Filterprefs
|
||||
ExercisesPage: "1.5.0",
|
||||
ClubsPage: "1.1.0",
|
||||
SkillsPage: "1.0.0",
|
||||
TrainingPlanningPage: "1.4.0",
|
||||
@@ -18,6 +18,7 @@ export const PAGE_VERSIONS = {
|
||||
TrainingFrameworkProgramEditPage: "1.5.0",
|
||||
TrainingUnitRunPage: "1.1.0",
|
||||
TrainingCoachPage: "1.0.0",
|
||||
AdminCatalogsPage: "2.2.0", // Updated: Frontend API Calls & Field Names für renamed tables
|
||||
TrainerContextsPage: "1.0.0", // New: Trainer-Kontext-Verwaltung
|
||||
AdminCatalogsPage: "2.2.0",
|
||||
TrainerContextsPage: "1.0.0",
|
||||
MediaLibraryPage: "1.2.0", // P-06: RightsDeclarationDialog + Altbestand-Indikator
|
||||
}
|
||||
Reference in new issue
Block a user