Repository navigation
Conversation
An API user calling /dev/sps/io/<input>/... gets HTTP 403 when it has no permission entry for that object (e.g. a newly added virtual input). - lox config user-grant <file> <user> <object> [--group] [--act N] appends <PRM REF="<uuid>" ACT="3"/> to the user's (or user group's) <PH> block, creating it if needed, and updates NUM. Idempotent; --act updates the access value of an existing entry. - lox config user-revoke <file> <user> <object> [--group] removes the entry and drops an emptied <PH>, so grant + revoke is byte-identical. uuid:<uuid> also revokes entries whose object no longer exists. - lox config user-perms <file> <user> [--group] lists permitted objects (title, type, ACT, uuid); `config users` gains a permission count and, with -o json, each user's uuid and resolved permissions. - --grant <user> on `config add --type virtual-input` and `config add-virtual-in`; add_virtual_in now also returns the VirtualIn's own UUID, which is what PRM REF points at. Users are matched by exact (case-insensitive) title or uuid:, never fuzzily; objects use the element selector and must match one element. No-op grants/revokes leave the file untouched. Cmd::Config boxes its ConfigCmd to keep clippy's large_enum_variant quiet.
This branch has not been deployed
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.
Summary
When an API user calls
/dev/sps/io/<input>/pulseon an object it has no permission entry for, for example a virtual input just added for a webhook, the Miniserver answersCode="403". lox-cli can add users but can't edit their object permissions. This PR adds that.Commands
user-grantappends<PRM REF="<uuid>" ACT="3"/>to the user's<PH>block and updatesNUM. It creates the block if needed.--actchanges the access value of an existing entry.user-revokeremoves the entry and drops an emptied<PH>, so a grant followed by a revoke gives a byte-identical file.uuid:<uuid>also revokes entries whose object no longer exists.--groupedits a user group (same<PH>/<PRM>structure).user-permslists the permitted objects (title, type, ACT, uuid).config usersgains a permission count and, with-o json, each user'suuidand resolved permissions.--grant <USER>on the two virtual-input commands.add_virtual_innow also returns the VirtualIn's own UUID, which is whatPRM REFpoints at.Safety
uuid:, never fuzzily, so the wrong account can't be edited by accident.<HP>) andTIMattributes are never touched.Notes
Cmd::Confignow boxesConfigCmd, because the extra--grantfield tripped clippy'slarge_enum_variantlint.ACT="1";--actcovers those.save_edited()to take&mut ConfigEditor; whichever merges second needs a one-line update at the new call sites.Testing
permissions.rs: grant, idempotent grant,--actupdate, revoke, revoking a missing object, group grant, ambiguous-object rejection, and grant-then-revoke byte identity on a BOM/CRLF fixture.tests/config_integration.rsandtests/cli_smoke.rs.COMMANDS.md,README.mdandCHANGELOG.mdare updated.cargo fmt --check,cargo clippy -- -D warnings,cargo build --releaseandcargo testpass.<PH NUM>and added one<PRM>line;