fix(p06): declared-Status deckt alle Sichtbarkeiten ab (kein Level-Vergleich mehr)
Deploy Development / deploy (push) Successful in 39s
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 58s
Deploy Development / deploy (push) Successful in 39s
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 58s
- check_rights_coverage: rights_status='declared' gibt immer 'ok' zurück (P-06-Erklärung gilt inhaltlich, nicht sichtbarkeitsabhängig) - assert_rights_for_promotion: 'insufficient'-Pfad entfernt - Tests: test_declared_private_insufficient_for_club → test_declared_covers_any_visibility version: 0.8.81 module: media_rights Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
6586d3b68b
commit
56e952f084
4 files changed
+30
-59
No files matched your search
+8
-28
@@ -159,37 +159,30 @@ def check_rights_coverage(cur: Any, asset_id: int, target_visibility: str) -> st
|
||||
|
||||
Returns:
|
||||
'ok' - vorhandene Erklaerung reicht aus
|
||||
'insufficient' - Erklaerung vorhanden, aber fuer niedrigere Sichtbarkeit
|
||||
'legacy' - Altmedium ohne Erklaerung
|
||||
'legacy' - Altmedium ohne Erklaerung (legacy_unreviewed)
|
||||
'blocked' - durch Admin gesperrt
|
||||
'no_declaration' - neues Medium ohne Erklaerung (sollte nicht vorkommen)
|
||||
|
||||
Hinweis: Eine P-06-Erklaerung beschreibt den Inhalt (Rechteinhaber, Personen, Musik etc.)
|
||||
und ist sichtbarkeitsunabhaengig. rights_status='declared' gilt daher fuer alle
|
||||
Sichtbarkeits-Stufen ohne Levelvergleich.
|
||||
"""
|
||||
cur.execute(
|
||||
"SELECT rights_status, rights_declared_for_visibility FROM media_assets WHERE id = %s",
|
||||
"SELECT rights_status FROM media_assets WHERE id = %s",
|
||||
(asset_id,),
|
||||
)
|
||||
row = cur.fetchone()
|
||||
if not row:
|
||||
return "no_declaration"
|
||||
|
||||
# psycopg2 RealDictCursor oder ähnlich
|
||||
if hasattr(row, "keys"):
|
||||
rs = row["rights_status"]
|
||||
rdv = row["rights_declared_for_visibility"]
|
||||
else:
|
||||
rs, rdv = row[0], row[1]
|
||||
|
||||
rs = (rs or "").strip().lower()
|
||||
rdv = (rdv or "").strip().lower() if rdv else None
|
||||
rs = (row[0] if not hasattr(row, "keys") else row["rights_status"] or "").strip().lower()
|
||||
|
||||
if rs == "blocked":
|
||||
return "blocked"
|
||||
if rs == "legacy_unreviewed":
|
||||
return "legacy"
|
||||
if rs == "declared":
|
||||
if rights_covers_target(rdv, target_visibility):
|
||||
return "ok"
|
||||
return "insufficient"
|
||||
return "ok"
|
||||
return "no_declaration"
|
||||
|
||||
|
||||
@@ -210,19 +203,6 @@ def assert_rights_for_promotion(cur: Any, asset_id: int, target_visibility: str)
|
||||
"asset_id": asset_id,
|
||||
},
|
||||
)
|
||||
if status == "insufficient":
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail={
|
||||
"code": "RIGHTS_SCOPE_INSUFFICIENT",
|
||||
"message": (
|
||||
f"Die vorhandene Erklaerung gilt nicht fuer die Ziel-Sichtbarkeit '{target_visibility}'. "
|
||||
"Bitte eine neue Erklaerung fuer diese Sichtbarkeit abgeben."
|
||||
),
|
||||
"asset_id": asset_id,
|
||||
"target_visibility": target_visibility,
|
||||
},
|
||||
)
|
||||
if status == "blocked":
|
||||
raise HTTPException(
|
||||
status_code=403,
|
||||
|
||||
Reference in new issue
Block a user