[Codex] fix(auth): restore admin-only access for datapoint and logic mutations#501
Open
Micsi wants to merge 1 commit into
Open
Conversation
Owner
|
@Micsi |
Collaborator
Author
|
ich bin anderer Meinung @abeggled . Ich habe eine Mietwohnung und möchte daher den Zugriff konsequent auf allen Ebenen beschränken können. Letztlich betrifft das nicht nur Visu und oder Logik sondern muss sich früher oder später durch das ganze System ziehen. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
get_admin_userfor datapoint mutation endpoints inobs/api/v1/datapoints.py(POST /api/v1/datapoints,PATCH /api/v1/datapoints/{id},DELETE /api/v1/datapoints/{id}).POST /api/v1/datapoints/{id}/valueso authenticated users are allowed to write values only ifusers.is_admin, and keep the existing page/session checks for unauthenticated page-context writes.get_admin_userfor logic graph mutation and execution endpoints inobs/api/v1/logic.py(POST /graphs,PUT/PATCH/DELETE /graphs/{id},POST /graphs/import,POST /graphs/{id}/run) while leaving read/list endpoints protected byget_current_user.get_admin_userand added a single DB lookup-based admin guard for the direct write path; no changes to event routing or adapter write logic.Testing
pytest -q tests/api/test_datapoints.py tests/api/test_logic.py, which failed because the specified test paths are not present in this checkout (collection error due to missing files).pytest -q -k 'datapoint or logic', which attempted collection but aborted withModuleNotFoundError: No module named 'pytest_asyncio', so tests could not be executed to completion in this environment.Codex Task