-
Notifications
You must be signed in to change notification settings - Fork 28
Proposal: Update Authorization to Allow Checks on Multiple Abilities #657
Comments
I like the idea, but I would use different blade directives to indicate AND or Or. I wouldn't tack on a third param. Usually it's a code smell when you're toggling behavior like that and it becomes a bit ambiguous when looking at it. (The params manifest as a true/false value and are hard to understand, even though this case you would prob pass a string.) I'm not sure that the default should be OR. Maybe it should be AND. Then we can use the blade directives: |
Would be better to have |
@decadence I like that direction. That way there is no ambiguity as to how permissions are actually resolved. I think that would alleviate @BrandonSurowiec 's concerns as well. This would also make it much simpler to implement, and not require retooling of all the underlying methods. |
The |
Yea, that sounds good: |
One thing I don't like about |
PR #19900 didn't make it. Next attempt is in PR #20084 (laravel/framework#20084) |
Right now checking multiple abilities is cumbersome, for example:
Would become more succinct using an optional array as the first parameter:
or:
The evaluation would default to
or
(meaning if any of the abilities were truthful, the check would pass. I could see adding an optional attribute in the 3rd$options
parameter that would allow setting the check toand
.This would have to work in blade directives and middlewares as well. Admittedly, this is a pretty intrusive change, but would not break backwards compatibility, as the first parameter would either be a string or an array of strings.
Would love to hear your thoughts, recommendations, etc. Thanks!
The text was updated successfully, but these errors were encountered: