fix(06.2): CR-07 add audit log entry for PATCH /shares/{share_id} permission change

This commit is contained in:
curo1305
2026-06-01 14:27:08 +02:00
parent 1a34209bb0
commit 1f2cec9ac3
+11
View File
@@ -247,6 +247,7 @@ async def list_shared_with_me(
async def update_share_permission(
share_id: str,
body: SharePermissionPatch,
request: Request,
session: AsyncSession = Depends(get_db),
current_user: User = Depends(get_regular_user),
) -> dict:
@@ -265,6 +266,16 @@ async def update_share_permission(
raise HTTPException(status_code=404, detail="Share not found")
share.permission = body.permission
await write_audit_log(
session=session,
event_type="share.permission_changed",
user_id=current_user.id,
actor_id=current_user.id,
resource_id=share.document_id,
ip_address=_ip(request),
metadata_={"share_id": str(share.id), "new_permission": body.permission},
)
await session.commit()
return {"id": str(share.id), "permission": share.permission}