feat(P-11): Implement Legal Hold functionality for media assets
Deploy Development / deploy (push) Successful in 40s
Test Suite / pytest-backend (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 10s
Test Suite / playwright-tests (push) Successful in 54s
Deploy Development / deploy (push) Successful in 40s
Test Suite / pytest-backend (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 10s
Test Suite / playwright-tests (push) Successful in 54s
- Added backend support for Legal Hold with new endpoints to set and release holds on media assets. - Introduced new database columns for managing Legal Hold status and reasons. - Updated frontend to include UI elements for setting and releasing Legal Holds, including a confirmation dialog. - Enhanced Media Library page to display Legal Hold status and actions for superadmins. - Implemented comprehensive backend tests covering all aspects of Legal Hold functionality. - Updated documentation to reflect changes in the upload rights specification and interface models. - Bumped version to 0.8.84 and updated MediaLibraryPage version to 1.6.0.
This commit is contained in:
1 parent
1640fe6045
commit
1ce6d929ce
16 files changed
+1180
-42
No files matched your search
@@ -6307,6 +6307,65 @@ a.analysis-split__nav-item {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* P-11: Legal Hold */
|
||||
.media-library__lc-block--legal-hold {
|
||||
background: rgba(216, 90, 48, 0.08);
|
||||
border: 1px solid rgba(216, 90, 48, 0.3);
|
||||
border-radius: 8px;
|
||||
margin-top: 8px;
|
||||
padding: 12px 14px 14px;
|
||||
}
|
||||
.media-library__legal-hold-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 0.68rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.03em;
|
||||
color: #fff;
|
||||
background: var(--danger);
|
||||
border-radius: 4px;
|
||||
padding: 1px 6px;
|
||||
margin-left: 4px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.media-library__legal-hold-info {
|
||||
font-size: 0.8rem;
|
||||
color: var(--text2);
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
.media-library__btn--legal-hold {
|
||||
color: var(--danger);
|
||||
border-color: var(--danger);
|
||||
}
|
||||
.media-library__btn--legal-hold:hover {
|
||||
background: rgba(216, 90, 48, 0.08);
|
||||
}
|
||||
.media-library__btn--legal-hold-confirm {
|
||||
background: var(--danger);
|
||||
color: #fff;
|
||||
border: none;
|
||||
}
|
||||
.media-library__btn--legal-hold-confirm:hover {
|
||||
background: #b84a22;
|
||||
}
|
||||
.media-library__legal-hold-dialog-asset {
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 12px;
|
||||
color: var(--text1);
|
||||
}
|
||||
.media-library__legal-hold-warning {
|
||||
background: rgba(216, 90, 48, 0.08);
|
||||
border-left: 3px solid var(--danger);
|
||||
padding: 8px 12px;
|
||||
border-radius: 0 6px 6px 0;
|
||||
margin-bottom: 12px;
|
||||
color: var(--text2);
|
||||
}
|
||||
.media-library__modal--narrow {
|
||||
max-width: 500px;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
/* Vorschau-Modal (Vollbild nah) */
|
||||
.media-library__overlay--preview {
|
||||
background: rgba(0, 0, 0, 0.72);
|
||||
|
||||
@@ -250,10 +250,24 @@ function eventTypeLabel(et) {
|
||||
copyright_change: 'Copyright geändert',
|
||||
metadata_change: 'Metadaten geändert',
|
||||
lifecycle_change: 'Lifecycle geändert',
|
||||
legal_hold_set: 'Sofortsperre gesetzt',
|
||||
legal_hold_released: 'Sofortsperre aufgehoben',
|
||||
}
|
||||
return MAP[et] || et
|
||||
}
|
||||
|
||||
const LEGAL_HOLD_REASON_LABELS = {
|
||||
rights_dispute: 'Rechtsstreit',
|
||||
consent_withdrawn: 'Einwilligung widerrufen',
|
||||
privacy_complaint: 'Datenschutzbeschwerde',
|
||||
copyright_complaint: 'Urheberrechtsbeschwerde',
|
||||
youth_protection: 'Jugendschutz',
|
||||
illegal_content: 'Illegaler Inhalt',
|
||||
other: 'Sonstige',
|
||||
}
|
||||
|
||||
const LEGAL_HOLD_REASON_CODES = Object.keys(LEGAL_HOLD_REASON_LABELS)
|
||||
|
||||
function visLabel(v) {
|
||||
if (v === 'private') return 'Privat'
|
||||
if (v === 'club') return 'Verein'
|
||||
@@ -324,6 +338,12 @@ export default function MediaLibraryPage() {
|
||||
const [journalCorrectionOpen, setJournalCorrectionOpen] = useState(false)
|
||||
const [journalCorrectionDraft, setJournalCorrectionDraft] = useState(null)
|
||||
const [journalCorrectionBusy, setJournalCorrectionBusy] = useState(false)
|
||||
// P-11: Legal Hold Dialog
|
||||
const [legalHoldDialog, setLegalHoldDialog] = useState(null) // { mode: 'set'|'release', assetId, assetName }
|
||||
const [legalHoldReasonCode, setLegalHoldReasonCode] = useState('rights_dispute')
|
||||
const [legalHoldReasonNote, setLegalHoldReasonNote] = useState('')
|
||||
const [legalHoldReleaseNote, setLegalHoldReleaseNote] = useState('')
|
||||
const [legalHoldBusy, setLegalHoldBusy] = useState(false)
|
||||
const mediaListFetchSeqRef = useRef(0)
|
||||
const gridTopAnchorRef = useRef(null)
|
||||
|
||||
@@ -454,6 +474,48 @@ export default function MediaLibraryPage() {
|
||||
}
|
||||
}
|
||||
|
||||
const openLegalHoldSet = (it) => {
|
||||
setLegalHoldReasonCode('rights_dispute')
|
||||
setLegalHoldReasonNote('')
|
||||
setLegalHoldDialog({ mode: 'set', assetId: it.id, assetName: it.original_filename || `#${it.id}` })
|
||||
}
|
||||
|
||||
const openLegalHoldRelease = (it) => {
|
||||
setLegalHoldReleaseNote('')
|
||||
setLegalHoldDialog({ mode: 'release', assetId: it.id, assetName: it.original_filename || `#${it.id}` })
|
||||
}
|
||||
|
||||
const submitLegalHold = async () => {
|
||||
if (!legalHoldDialog) return
|
||||
if (legalHoldDialog.mode === 'set') {
|
||||
if (!legalHoldReasonNote.trim() || legalHoldReasonNote.trim().length < 5) {
|
||||
alert('Bitte gib eine Begründung ein (mind. 5 Zeichen).')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (!legalHoldReleaseNote.trim() || legalHoldReleaseNote.trim().length < 5) {
|
||||
alert('Bitte gib eine Freigabe-Begründung ein (mind. 5 Zeichen).')
|
||||
return
|
||||
}
|
||||
}
|
||||
setLegalHoldBusy(true)
|
||||
try {
|
||||
if (legalHoldDialog.mode === 'set') {
|
||||
await api.setMediaAssetLegalHold(legalHoldDialog.assetId, legalHoldReasonCode, legalHoldReasonNote)
|
||||
} else {
|
||||
await api.releaseMediaAssetLegalHold(legalHoldDialog.assetId, legalHoldReleaseNote)
|
||||
}
|
||||
setLegalHoldDialog(null)
|
||||
setModal(null)
|
||||
setModalDraft(null)
|
||||
await loadMedia()
|
||||
} catch (e) {
|
||||
alert(e.message || String(e))
|
||||
} finally {
|
||||
setLegalHoldBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
function parseApiErrorCode(msg) {
|
||||
try {
|
||||
const d = JSON.parse(msg)
|
||||
@@ -902,7 +964,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' && (
|
||||
{it.legal_hold_active && (
|
||||
<span className="media-library__legal-hold-badge" title="Sofortsperre aktiv (Legal Hold)">
|
||||
Sofort gesperrt
|
||||
</span>
|
||||
)}
|
||||
{!it.legal_hold_active && 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"
|
||||
@@ -1401,6 +1468,43 @@ export default function MediaLibraryPage() {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{isSuperadmin ? (
|
||||
<div className="media-library__lc-block media-library__lc-block--legal-hold">
|
||||
<div className="media-library__lc-title">Sofortsperre (Legal Hold)</div>
|
||||
{modal.legal_hold_active ? (
|
||||
<div>
|
||||
<p className="media-library__legal-hold-info">
|
||||
<strong>Aktiv seit:</strong>{' '}
|
||||
{modal.legal_hold_set_at ? new Date(modal.legal_hold_set_at).toLocaleString('de-DE') : '—'}
|
||||
{modal.legal_hold_reason_code ? (
|
||||
<> · <strong>Grund:</strong> {LEGAL_HOLD_REASON_LABELS[modal.legal_hold_reason_code] || modal.legal_hold_reason_code}</>
|
||||
) : null}
|
||||
</p>
|
||||
{modal.legal_hold_reason_note ? (
|
||||
<p className="media-library__legal-hold-info">{modal.legal_hold_reason_note}</p>
|
||||
) : null}
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
disabled={busy}
|
||||
onClick={() => openLegalHoldRelease(modal)}
|
||||
>
|
||||
Sperre aufheben
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary media-library__btn--legal-hold"
|
||||
disabled={busy}
|
||||
onClick={() => openLegalHoldSet(modal)}
|
||||
>
|
||||
Sofort sperren
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{modal.permissions?.superadmin_lifecycle ? (
|
||||
<div className="media-library__lc-block media-library__lc-block--danger">
|
||||
<div className="media-library__lc-title">Superadmin</div>
|
||||
@@ -1526,6 +1630,32 @@ export default function MediaLibraryPage() {
|
||||
<span>{nw.copyright_notice || '—'}</span>
|
||||
</div>
|
||||
</>
|
||||
) : evt.event_type === 'legal_hold_set' ? (
|
||||
<>
|
||||
<div className="media-library__journal-audit-row">
|
||||
<span className="media-library__journal-audit-label">Grund:</span>
|
||||
<span>{LEGAL_HOLD_REASON_LABELS[nw.legal_hold_reason_code] || nw.legal_hold_reason_code || '—'}</span>
|
||||
</div>
|
||||
{nw.legal_hold_reason_note ? (
|
||||
<div className="media-library__journal-audit-row">
|
||||
<span className="media-library__journal-audit-label">Begründung:</span>
|
||||
<span>{nw.legal_hold_reason_note}</span>
|
||||
</div>
|
||||
) : null}
|
||||
</>
|
||||
) : evt.event_type === 'legal_hold_released' ? (
|
||||
<>
|
||||
{nw.legal_hold_release_note ? (
|
||||
<div className="media-library__journal-audit-row">
|
||||
<span className="media-library__journal-audit-label">Freigabegrund:</span>
|
||||
<span>{nw.legal_hold_release_note}</span>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="media-library__journal-audit-row">
|
||||
<span className="media-library__journal-audit-label">Rechtsstatus wiederhergestellt:</span>
|
||||
<span>{nw.rights_status || '—'}</span>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
Object.keys(nw).map((k) => (
|
||||
<div key={k} className="media-library__journal-audit-row">
|
||||
@@ -1800,6 +1930,102 @@ export default function MediaLibraryPage() {
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{legalHoldDialog ? (
|
||||
<div className="media-library__overlay" role="dialog" aria-modal="true" aria-labelledby="legal-hold-dialog-title">
|
||||
<div className="media-library__modal media-library__modal--narrow">
|
||||
<div className="media-library__modal-head">
|
||||
<h2 id="legal-hold-dialog-title">
|
||||
{legalHoldDialog.mode === 'set' ? 'Sofortsperre setzen' : 'Sofortsperre aufheben'}
|
||||
</h2>
|
||||
<button
|
||||
type="button"
|
||||
className="media-library__icon-btn"
|
||||
onClick={() => setLegalHoldDialog(null)}
|
||||
aria-label="Schließen"
|
||||
disabled={legalHoldBusy}
|
||||
>
|
||||
<X size={22} />
|
||||
</button>
|
||||
</div>
|
||||
<div className="media-library__modal-body">
|
||||
<p className="media-library__legal-hold-dialog-asset">
|
||||
Medium: <strong>{legalHoldDialog.assetName}</strong>
|
||||
</p>
|
||||
|
||||
{legalHoldDialog.mode === 'set' ? (
|
||||
<>
|
||||
<p className="media-library__hint media-library__legal-hold-warning">
|
||||
Die Sofortsperre sperrt das Medium sofort für alle normalen Nutzer. Der Rechtsstatus wird auf „blocked" gesetzt. Die Sperre kann nur von Superadmins aufgehoben werden.
|
||||
</p>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Grund *</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={legalHoldReasonCode}
|
||||
onChange={(e) => setLegalHoldReasonCode(e.target.value)}
|
||||
disabled={legalHoldBusy}
|
||||
>
|
||||
{LEGAL_HOLD_REASON_CODES.map((code) => (
|
||||
<option key={code} value={code}>{LEGAL_HOLD_REASON_LABELS[code]}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Begründung * (mind. 5 Zeichen)</label>
|
||||
<textarea
|
||||
className="form-input"
|
||||
rows={3}
|
||||
value={legalHoldReasonNote}
|
||||
onChange={(e) => setLegalHoldReasonNote(e.target.value)}
|
||||
placeholder="Konkrete Begründung für die Sofortsperre..."
|
||||
disabled={legalHoldBusy}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p className="media-library__hint">
|
||||
Die Aufhebung der Sofortsperre gibt das Medium wieder frei. Der Rechtsstatus wird wiederhergestellt.
|
||||
</p>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Freigabe-Begründung * (mind. 5 Zeichen)</label>
|
||||
<textarea
|
||||
className="form-input"
|
||||
rows={3}
|
||||
value={legalHoldReleaseNote}
|
||||
onChange={(e) => setLegalHoldReleaseNote(e.target.value)}
|
||||
placeholder="Grund für die Aufhebung der Sofortsperre..."
|
||||
disabled={legalHoldBusy}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
<div style={{ display: 'flex', gap: 8, marginTop: 16 }}>
|
||||
<button
|
||||
type="button"
|
||||
className={`btn ${legalHoldDialog.mode === 'set' ? 'media-library__btn--legal-hold-confirm' : 'btn-primary'}`}
|
||||
disabled={legalHoldBusy}
|
||||
onClick={submitLegalHold}
|
||||
>
|
||||
{legalHoldBusy
|
||||
? (legalHoldDialog.mode === 'set' ? 'Sperren…' : 'Aufheben…')
|
||||
: (legalHoldDialog.mode === 'set' ? 'Jetzt sperren' : 'Sperre aufheben')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
disabled={legalHoldBusy}
|
||||
onClick={() => setLegalHoldDialog(null)}
|
||||
>
|
||||
Abbrechen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -683,6 +683,25 @@ export async function attachExerciseMediaFromAsset(exerciseId, body) {
|
||||
})
|
||||
}
|
||||
|
||||
// P-11: Legal-Hold-Endpunkte
|
||||
export async function setMediaAssetLegalHold(assetId, reasonCode, reasonNote) {
|
||||
return request(`/api/admin/media-assets/${assetId}/legal-hold`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ reason_code: reasonCode, reason_note: reasonNote }),
|
||||
})
|
||||
}
|
||||
|
||||
export async function releaseMediaAssetLegalHold(assetId, releaseNote) {
|
||||
return request(`/api/admin/media-assets/${assetId}/legal-hold/release`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ release_note: releaseNote }),
|
||||
})
|
||||
}
|
||||
|
||||
export async function listMediaAssetsWithLegalHold(limit = 100, offset = 0) {
|
||||
return request(`/api/admin/media-assets/legal-hold?limit=${limit}&offset=${offset}`)
|
||||
}
|
||||
|
||||
export async function getExercise(id) {
|
||||
return request(`/api/exercises/${id}`)
|
||||
}
|
||||
@@ -1430,6 +1449,9 @@ export const api = {
|
||||
getMediaAssetJournal,
|
||||
addMediaAssetDeclarationCorrection,
|
||||
attachExerciseMediaFromAsset,
|
||||
setMediaAssetLegalHold,
|
||||
releaseMediaAssetLegalHold,
|
||||
listMediaAssetsWithLegalHold,
|
||||
listExerciseProgressionGraphs,
|
||||
getExerciseProgressionGraph,
|
||||
createExerciseProgressionGraph,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Shinkan Jinkendo Frontend Version
|
||||
|
||||
export const APP_VERSION = "0.8.83"
|
||||
export const APP_VERSION = "0.8.84"
|
||||
export const BUILD_DATE = "2026-05-11"
|
||||
|
||||
export const PAGE_VERSIONS = {
|
||||
@@ -20,7 +20,7 @@ export const PAGE_VERSIONS = {
|
||||
TrainingCoachPage: "1.0.0",
|
||||
AdminCatalogsPage: "2.2.0",
|
||||
TrainerContextsPage: "1.0.0",
|
||||
MediaLibraryPage: "1.5.0", // P-06: Volljournal mit Audit-Log und Korrektur-Formular
|
||||
MediaLibraryPage: "1.6.0", // P-11: Legal-Hold-Badge, Superadmin-Aktionen, Bestaetigungs-Dialog
|
||||
ExerciseInlineFileMediaModal: "1.1.0", // P-06: RightsDeclarationDialog vor Upload
|
||||
ExerciseInlineEmbedModal: "1.1.0", // P-06: RightsDeclarationDialog vor Embed-Upload
|
||||
}
|
||||
Reference in new issue
Block a user