fix(roles): support system permissions in roles permissions add/list and add remove#20
Open
chrisaddams wants to merge 1 commit into
Open
fix(roles): support system permissions in roles permissions add/list and add remove#20chrisaddams wants to merge 1 commit into
chrisaddams wants to merge 1 commit into
Conversation
…and add a remove command System permissions (such as anythink_subscription_plans:*) are defined globally without a corresponding entity row — their entity_id is null. Three related gaps showed up when trying to manage them via the CLI: - roles permissions add hard-failed when the named entity didn't exist, so granting anythink_subscription_plans:read was impossible. - roles permissions list filtered out any permission whose entity_id was null, so even when a system permission was assigned through the admin UI it was invisible to the CLI. - There was no roles permissions remove, so toggling off was impossible without dropping into the API directly. This change makes the entity lookup tolerant of a 404, falls back to matching permissions by exact name + entity_id == null when the entity isn't found (so we only grant true system permissions, not anything that happens to share a name), drops the entity_id filter from list, and adds a parallel remove command.
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
System permissions (e.g. `anythink_subscription_plans:*`) are defined globally without a corresponding entity row — their `entity_id` is `null`. Three gaps surfaced when trying to manage them via the CLI:
Changes
Verified locally