Ergänze die Benutzerverwaltung, damit der Betreiber Konten, Rollen und Zugänge verwalten kann.
Der Betreiber legt Konten mit Einmal-Passwort an, deaktiviert und aktiviert sie, setzt Passwörter zurück, beendet Sitzungen und vergibt die Betreiberrolle; der letzte Betreiber und das eigene Konto sind geschützt. Nutzer ändern ihr Passwort und sehen ihre Geräte. Räume kennen neben Mitglied und Verwalter die Rolle Leser, die nichts anlegt und keine Bearbeiten- oder Freigeben-Grants erhält. Verwalter pflegen Mitglieder, Rollen und Einladungen mit Rolle; der Betreiber sieht Räume ohne Inhalte und liest das Verwaltungsprotokoll. Die Login-Begrenzung steht in der Datenbank, unbekannte Konten laufen durch einen Zeitausgleich. Die lokale Suite läuft mit 116 Tests grün, der Frontend-Build und 16 Node-Tests ebenfalls. Die Oberfläche wurde noch nicht im Browser bedient. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eb58dce4cd
commit
037c0724a8
34 files changed
+2790
-391
No files matched your search
@@ -8,6 +8,7 @@ from uuid import UUID, uuid4
|
||||
|
||||
from psycopg.types.json import Json
|
||||
|
||||
from app.access.roles import ensure_can_create
|
||||
from app.access.policy import (
|
||||
Ctx,
|
||||
Rights,
|
||||
@@ -74,6 +75,7 @@ def _placement(context: Ctx, placement: Ctx | None) -> tuple[Ctx, Ctx]:
|
||||
|
||||
|
||||
def create_case(conn, actor: UUID, scope_id: UUID, title: str, parent_case_id: UUID | None, rights_mode: str) -> dict:
|
||||
ensure_can_create(conn, actor, scope_id)
|
||||
title = title.strip()
|
||||
if parent_case_id is None:
|
||||
row = conn.execute(
|
||||
@@ -339,6 +341,7 @@ def set_chapter_date(
|
||||
|
||||
|
||||
def create_matter(conn, actor: UUID, scope_id: UUID, title: str, parent_matter_id: UUID | None, context: Ctx | None) -> dict:
|
||||
ensure_can_create(conn, actor, scope_id)
|
||||
title = title.strip()
|
||||
if parent_matter_id is None:
|
||||
row = conn.execute(
|
||||
@@ -702,6 +705,12 @@ def _actor_rights_for(conn, actor: UUID, kind: str, resource_id: UUID, context:
|
||||
return rights
|
||||
|
||||
|
||||
def _is_reader_of_home(conn, account_id: UUID, home_scope_id: UUID) -> bool:
|
||||
from app.access.roles import room_role
|
||||
|
||||
return room_role(conn, account_id, home_scope_id) == "reader"
|
||||
|
||||
|
||||
def grant_access(
|
||||
conn,
|
||||
actor: UUID,
|
||||
@@ -741,6 +750,8 @@ def grant_access(
|
||||
).fetchone()
|
||||
if account is None:
|
||||
raise not_found()
|
||||
if (can_edit or can_share) and _is_reader_of_home(conn, grantee_id, resource["home_scope_id"]):
|
||||
raise unprocessable("Diese Person ist in dem Datenraum der Akte nur Leser und kann nicht bearbeiten oder freigeben.")
|
||||
existing = conn.execute(
|
||||
"""
|
||||
SELECT id, use_owner_sources FROM access_grants
|
||||
@@ -909,6 +920,7 @@ def create_note(
|
||||
received_on: date | None = None,
|
||||
communication_direction: str | None = None,
|
||||
) -> dict:
|
||||
ensure_can_create(conn, actor, scope_id)
|
||||
document = clean_document(document)
|
||||
target, rights_context = _placement(context, placement)
|
||||
require_container_edit(conn, actor, target, rights_context)
|
||||
@@ -999,6 +1011,7 @@ def add_annotation(conn, actor: UUID, binding_id: UUID, body: str, context: Ctx
|
||||
|
||||
|
||||
def create_external(conn, actor: UUID, scope_id: UUID, title: str, source: str, external_id: str, context: Ctx, placement: Ctx | None, chapter_id: UUID | None, document_on, sent_on, received_on, detail: dict | None = None, communication_direction: str | None = None) -> dict:
|
||||
ensure_can_create(conn, actor, scope_id)
|
||||
from app.sourceregistry import accepts_reference
|
||||
|
||||
if not accepts_reference(source):
|
||||
@@ -1023,6 +1036,7 @@ def create_external(conn, actor: UUID, scope_id: UUID, title: str, source: str,
|
||||
|
||||
|
||||
def create_file(conn, actor: UUID, scope_id: UUID, title: str, filename: str, data: bytes, context: Ctx, placement: Ctx | None, chapter_id: UUID | None, document_on, sent_on, received_on, media_root: str, max_bytes: int, rollback_files: list[Path], communication_direction: str | None = None) -> dict:
|
||||
ensure_can_create(conn, actor, scope_id)
|
||||
if not data or len(data) > max_bytes:
|
||||
raise unprocessable("Die Datei ist leer oder zu groß.")
|
||||
content_type = sniff(data)
|
||||
@@ -1112,6 +1126,7 @@ def delete_element(conn, actor: UUID, element_id: UUID, expected: int, media_roo
|
||||
|
||||
|
||||
def create_task(conn, actor: UUID, scope_id: UUID, title: str, due_on: date | None, matter_id: UUID | None, context: Ctx | None) -> dict:
|
||||
ensure_can_create(conn, actor, scope_id)
|
||||
if matter_id is not None:
|
||||
require_matter(conn, actor, matter_id, context, "edit")
|
||||
row = conn.execute(
|
||||
@@ -1217,6 +1232,7 @@ def assign_task(conn, actor: UUID, task_id: UUID, assignee_id: UUID | None, cont
|
||||
|
||||
|
||||
def create_deadline(conn, actor: UUID, scope_id: UUID, title: str, due_on: date, matter_id: UUID | None, context: Ctx | None) -> dict:
|
||||
ensure_can_create(conn, actor, scope_id)
|
||||
if matter_id is not None:
|
||||
require_matter(conn, actor, matter_id, context, "edit")
|
||||
row = conn.execute(
|
||||
|
||||
Reference in new issue
Block a user