feat: update application version to 0.8.35 and enhance profile access controls
Deploy Development / deploy (push) Successful in 34s
Test Suite / pytest-backend (push) Successful in 6s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 34s
Deploy Development / deploy (push) Successful in 34s
Test Suite / pytest-backend (push) Successful in 6s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 34s
- Bumped application version to 0.8.35 in both backend and frontend files. - Updated profile retrieval and deletion endpoints to restrict access to the profile owner or platform admins, returning a 403 status for unauthorized access. - Added integration tests to verify access control for profile retrieval. - Enhanced changelog to reflect the new version and changes made in this release.
This commit is contained in:
1 parent
f03330bf77
commit
caab9f2863
5 files changed
+188
-6
No files matched your search
@@ -114,8 +114,12 @@ def profile_document(pid: str) -> dict:
|
||||
|
||||
|
||||
@router.get("/profiles/{pid}")
|
||||
def get_profile(pid: str, _session=Depends(require_auth)):
|
||||
"""Get profile by ID."""
|
||||
def get_profile(pid: str, session=Depends(require_auth)):
|
||||
"""Profil nach ID — nur eigenes Profil oder Plattform-Admin (wie PUT)."""
|
||||
viewer = session["profile_id"]
|
||||
role = session.get("role") or ""
|
||||
if str(viewer) != str(pid) and not is_platform_admin(role):
|
||||
raise HTTPException(status_code=403, detail="Keine Berechtigung für dieses Profil")
|
||||
return profile_document(pid)
|
||||
def _run_profile_update(pid: str, p: ProfileUpdate, tenant: TenantContext) -> dict:
|
||||
"""Gemeinsame PUT-Logik für /profiles/{id} und Legacy /profile."""
|
||||
@@ -249,7 +253,13 @@ def update_profile(pid: str, p: ProfileUpdate, tenant: TenantContext = Depends(g
|
||||
|
||||
@router.delete("/profiles/{pid}")
|
||||
def delete_profile(pid: str, session=Depends(require_auth)):
|
||||
"""Delete profile (admin)."""
|
||||
"""Profil löschen — nur Plattform-Admin; letztes Profil wird geschützt."""
|
||||
role = session.get("role") or ""
|
||||
if not is_platform_admin(role):
|
||||
raise HTTPException(
|
||||
status_code=403,
|
||||
detail="Nur Plattform-Administratoren dürfen Profile löschen",
|
||||
)
|
||||
with get_db() as conn:
|
||||
cur = get_cursor(conn)
|
||||
cur.execute("SELECT COUNT(*) as count FROM profiles")
|
||||
|
||||
Reference in new issue
Block a user