fix: assertAdmin
sending wrong ability name to gate
#3501
Merged
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.
Fixes #0000
Changes proposed in this pull request:
Currently, the full user record serialized as JSON is being sent to the gate when checking for admin privilege, while the intended ability name
administrate
is sent as the gate parameter as string. This works because the gate will always returntrue
for admins, but this means extensions can't customize theadministrate
ability since it's never actually passed.I have not tested the change locally, but I wanted to start with the PR right away since it's easier to explain this way instead of creating a whole issue about it.
This is the output from my gate logger extension prior to the fix, it's supposed to say
Gate Logger administrate(Actor: Admin, [GLOBAL])
Maybe this is worth an integration test? I'm not sure which feature could be tested for
administrate
extensibility though.Necessity
Confirmed
composer test
).Required changes: