Governance: official nur Superadmin; Privat-Archiv Verein wählbar; Club-Übung Copyright; gleiche Medienordner
Deploy Development / deploy (push) Successful in 36s
Test Suite / pytest-backend (push) Successful in 33s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Successful in 47s
Deploy Development / deploy (push) Successful in 36s
Test Suite / pytest-backend (push) Successful in 33s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Successful in 47s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
01636b5baf
commit
f354bd9f77
12 files changed
+259
-38
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useState, useCallback, useRef } from 'react'
|
||||
import { useEffect, useState, useCallback, useRef, useMemo } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import {
|
||||
LayoutGrid,
|
||||
@@ -235,6 +235,23 @@ export default function MediaLibraryPage() {
|
||||
const isPlatformAdmin = user?.role === 'admin' || user?.role === 'superadmin'
|
||||
const isSuperadmin = user?.role === 'superadmin'
|
||||
|
||||
const archiveVisOptions = useMemo(
|
||||
() => VIS_OPTIONS.filter((o) => o.value !== 'official' || isSuperadmin),
|
||||
[isSuperadmin],
|
||||
)
|
||||
|
||||
const modalVisibilityOptions = useMemo(() => {
|
||||
if (!modalDraft) return archiveVisOptions
|
||||
const o = [...archiveVisOptions]
|
||||
if (!o.some((x) => x.value === modalDraft.visibility)) {
|
||||
o.push({
|
||||
value: modalDraft.visibility,
|
||||
label: visibilityUiLabel(modalDraft.visibility),
|
||||
})
|
||||
}
|
||||
return o
|
||||
}, [archiveVisOptions, modalDraft])
|
||||
|
||||
const [lifecycle, setLifecycle] = useState('active')
|
||||
const [q, setQ] = useState('')
|
||||
const [items, setItems] = useState([])
|
||||
@@ -374,7 +391,7 @@ export default function MediaLibraryPage() {
|
||||
}
|
||||
if (p.change_visibility) {
|
||||
body.visibility = modalDraft.visibility
|
||||
if (modalDraft.visibility === 'club') {
|
||||
if (modalDraft.visibility === 'club' || (modalDraft.visibility === 'private' && isPlatformAdmin)) {
|
||||
const cid = Number(modalDraft.club_id)
|
||||
if (!cid) {
|
||||
alert('Bitte einen Verein wählen.')
|
||||
@@ -421,7 +438,7 @@ export default function MediaLibraryPage() {
|
||||
}
|
||||
if (bulkApplyVis) {
|
||||
body.visibility = bulkVis
|
||||
if (bulkVis === 'club') {
|
||||
if (bulkVis === 'club' || (bulkVis === 'private' && isPlatformAdmin)) {
|
||||
const cid = Number(bulkClubId)
|
||||
if (!cid) {
|
||||
alert('Bitte einen Verein wählen.')
|
||||
@@ -482,12 +499,18 @@ export default function MediaLibraryPage() {
|
||||
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
|
||||
}
|
||||
setUploadBusy(true)
|
||||
setUploadSummary('')
|
||||
try {
|
||||
const res = await api.bulkUploadMediaAssets(list, {
|
||||
visibility: uploadVis,
|
||||
...(uploadVis === 'club' ? { club_id: Number(uploadClubId) } : {}),
|
||||
...((uploadVis === 'club' || (uploadVis === 'private' && isPlatformAdmin)) && Number(uploadClubId)
|
||||
? { club_id: Number(uploadClubId) }
|
||||
: {}),
|
||||
})
|
||||
setUploadSummary(
|
||||
`Archiv-Upload: neu ${res.created_count}, bereits vorhanden ${res.duplicate_count}, fehlgeschlagen ${res.failed_count}. Liste aktualisiert.`,
|
||||
@@ -520,8 +543,9 @@ export default function MediaLibraryPage() {
|
||||
</div>
|
||||
</div>
|
||||
<p className="media-library__intro">
|
||||
Veröffentlichte Medien (Verein/Plattform) und eigene Uploads. Suche durchsucht Bezeichner,
|
||||
technischen Speicherpfad, Copyright-Text und Schlagwörter. Vorschau: Vorschaubild antippen.
|
||||
Veröffentlichte Medien (Verein/Plattform) und eigene Uploads — „Privat“ steuert nur, wer das Asset in der
|
||||
Datenbank sieht; der Ablageordner folgt dem gewählten Verein wie bei „Verein“. Plattform-Admins wählen den
|
||||
Zielverein bei privatem Archiv-Upload aktiv. Suche durchsucht Bezeichner, Speicherpfad, Copyright und Tags.
|
||||
Bearbeiten über das Menü — Bulk in der unteren Leiste.
|
||||
</p>
|
||||
</header>
|
||||
@@ -647,13 +671,13 @@ export default function MediaLibraryPage() {
|
||||
}}
|
||||
aria-label="Sichtbarkeit für neuen Upload"
|
||||
>
|
||||
{VIS_OPTIONS.map((o) => (
|
||||
{archiveVisOptions.map((o) => (
|
||||
<option key={o.value} value={o.value}>
|
||||
Upload: {o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{uploadVis === 'club' ? (
|
||||
{uploadVis === 'club' || (uploadVis === 'private' && isPlatformAdmin) ? (
|
||||
<select
|
||||
className="form-input"
|
||||
value={uploadClubId}
|
||||
@@ -969,13 +993,13 @@ export default function MediaLibraryPage() {
|
||||
{bulkApplyVis ? (
|
||||
<>
|
||||
<select className="form-input" value={bulkVis} onChange={(e) => setBulkVis(e.target.value)}>
|
||||
{VIS_OPTIONS.map((o) => (
|
||||
{archiveVisOptions.map((o) => (
|
||||
<option key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{bulkVis === 'club' ? (
|
||||
{bulkVis === 'club' || (bulkVis === 'private' && isPlatformAdmin) ? (
|
||||
<select className="form-input" value={bulkClubId} onChange={(e) => setBulkClubId(e.target.value)}>
|
||||
<option value="">— Verein —</option>
|
||||
{clubs.map((c) => (
|
||||
@@ -1090,13 +1114,13 @@ export default function MediaLibraryPage() {
|
||||
value={modalDraft.visibility}
|
||||
onChange={(e) => setModalDraft((d) => ({ ...d, visibility: e.target.value }))}
|
||||
>
|
||||
{VIS_OPTIONS.map((o) => (
|
||||
{modalVisibilityOptions.map((o) => (
|
||||
<option key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{modalDraft.visibility === 'club' ? (
|
||||
{modalDraft.visibility === 'club' || (modalDraft.visibility === 'private' && isPlatformAdmin) ? (
|
||||
<>
|
||||
<label className="form-label">Verein</label>
|
||||
<select
|
||||
|
||||
Reference in new issue
Block a user