Gib verknüpfte Originale im Datenraum je Person über die eigenen Zugänge frei, damit Raummitglieder Paperless-Dokumente und E-Mails geteilter Akten lesen können.
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 6m39s
Test Suite / frontend-build (push) Successful in 24s
Test Suite / smoke-dev (push) Successful in 0s

Die Raumfreigabe allein gab die Zugänge des Owners nicht weiter. Ein Leser im Raum sah die Akte,
aber kein Original. Neu ist room_source_access: Wer im Raum teilen darf, schaltet für ein Mitglied
„Originale über meine Zugänge“ ein. Das gilt für alle eigenen, mit dem Raum geteilten Einträge.
Ausnahmen, Ende der Raumfreigabe und Verlassen des Raums schließen den Abruf. Beschluss R-01 ist
entsprechend ergänzt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-04 15:19:15 +01:00
1 parent 363ecdfd0a
commit 15e0dc7e52
15 files changed
+362 -13

No files matched your search

+36 -7
View File
@@ -458,8 +458,35 @@ def _source_grant(conn, actor: UUID, kind: str, resource_id: UUID) -> dict | Non
).fetchone()
def room_source_access(conn, actor: UUID, kind: str, resource_id: UUID, owner_id: UUID) -> bool:
"""Whether a room the entry is shared with lets this member read the owner's linked originals.
The owner has switched it on for this person in that room. Only an active room, an active
membership with a reading role and an active account count.
"""
readers = [role for role, rights in ROOM_RIGHTS.items() if rights.read]
row = conn.execute(
"""
SELECT 1
FROM room_shares s
JOIN room_memberships m ON m.room_id = s.room_id AND m.subject_id = %s AND m.status = 'active'
JOIN data_rooms r ON r.id = s.room_id AND r.kind = 'organization' AND r.status = 'active'
JOIN auth_accounts a ON a.id = m.subject_id AND a.status = 'active'
JOIN room_source_access x ON x.room_id = s.room_id AND x.subject_id = m.subject_id AND x.owner_id = %s
WHERE s.resource_kind = %s AND s.resource_id = %s AND m.role = ANY(%s)
LIMIT 1
""",
(actor, owner_id, kind, resource_id, readers),
).fetchone()
return row is not None
def mediated_source_owner(conn, actor: UUID, element: dict, context: Ctx | None) -> UUID | None:
"""Owner whose stored connector may serve this reader. None unless the grant allows it."""
"""Owner whose stored connector may serve this reader.
None unless the owner allowed it, either on the personal grant or for this person in a room
the entry is shared with. Read rights and exceptions are checked first.
"""
if context is None or not element_rights(conn, actor, element, context).read:
return None
if context.kind == "case":
@@ -467,19 +494,21 @@ def mediated_source_owner(conn, actor: UUID, element: dict, context: Ctx | None)
if resource is None:
return None
resource = _rights_bearing_case(conn, resource)
grant = _source_grant(conn, actor, "case", resource["id"])
elif context.kind == "matter":
resource = get_matter(conn, context.id)
if resource is None:
return None
grant = _source_grant(conn, actor, "matter", resource["id"])
else:
return None
if resource["owner_subject_id"] == actor:
owner = resource["owner_subject_id"]
if owner == actor:
return None
if grant is None or not grant["can_read"] or not grant["use_owner_sources"]:
return None
return resource["owner_subject_id"]
grant = _source_grant(conn, actor, context.kind, resource["id"])
if grant is not None and grant["can_read"] and grant["use_owner_sources"]:
return owner
if room_source_access(conn, actor, context.kind, resource["id"], owner):
return owner
return None
def element_rights_via_case_or_direct(conn, actor: UUID, element: dict, context: Ctx | None) -> Rights: