-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple Guards on a Single Route #488
Comments
Yeah, I made this work fine by hacking extractGuard() and assignRealValuesTo() to return a list of guards, then looping over that in authorization(). I'll try to put a PR together in the morning. |
Nudge. @santigarcor, does anyone look at these? The attached PR includes tests and adds implied functionality without any breaking changes. I wasn't totally sure about the configuration syntax I chose, but it should be close. |
@derekrprice I've been a bit busy lately, I could take a deep look at it this weekend. |
@santigarcor I just took what was previously supported and extended it with additional guards separated by pipes (e.g. |
@santigarcor @derekrprice Has this old issue been resolved? I am trying to decide between this package and https://github.com/spatie/laravel-permission, and while I like spatie's packages because of how well / often they are maintained, I do like the teams functionality that comes with laratrust. Is this package being actively maintained, because I am seeing some old issues that are yet to be resolved. |
No. Per my comment which closed PR #489:
|
In that case, it would be great to get a fix for this if possible @santigarcor! |
Describe the bug
Laravel handles this auth statement just fine, such that 3 user types, each with their own guards can share a single route. If any of the three guards allow access, then access to the route is allowed:
Unfortunately, when I try to add a Laratrust permission check, only the first guard that I list is checked:
This seems to be an explicit assumption of LaratrustMiddleware::extractGuard(), as it uses ->first() during the extraction:
To Reproduce
See above.
Question
Is there some way to manage multiple guards on the same route?
The text was updated successfully, but these errors were encountered: