fix: predicate functions should respect action grouping (#50)#51
Merged
vincentvanbush merged 1 commit intomasterfrom Dec 22, 2025
Merged
Conversation
3 tasks
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
itamm15
approved these changes
Dec 22, 2025
| When an action depends on other permissions (e.g., show: [:read]), | ||
| the authorization check should verify if the required permissions are granted. | ||
| """ | ||
| use ExUnit.Case, async: true |
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.
Pull Request
Description
Alows authorization module to answer
trueif permission is granted for:showwhen action grouping containsshow: [:read]and:readis given explicitly.Type of Change
Related Issues
Fixes #50
Changes Made
authorization_moduleargument toPermit.can?function to allow traversing the action grouping map, so that with ana: [:b, :c]grouping and:b:and:c:granted explicilty, permission to:ais also resolved as true.Testing
Added test examples that ensure that with
a: [:b, :c]grouping,:band:cpermissions coexisting make:aresolve to true, while:balone doesn't, and permission to:adoesn't imply:band:c.Test Environment
Test Cases
Documentation
Code Quality
Backward Compatibility
Breaking Changes
If the app relied on the prior behaviour, it won't be kept compatible. That is, most commonly, in Phoenix the grouping would be given as
show: [:read], which means that the:showaction requires the:readpermission. Permit.Phoenix accounts for this, but up until now Permit itself didn't.Performance Impact
Performance Notes
Security Considerations
Additional Notes
Screenshots/Examples
See added tests
Checklist
Reviewer Notes