We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Can I use boolean operators in the guard's middleware?
In the example below, when I separe resources with commas, that means an and operator.
and
Route .post('register', 'UserController.register') .middleware(['auth', 'guard: user.create, user.read'])
What could I do to trigger them using another operators, like or or not.
or
not
Something like this:
guard: user.create || user.read && post.create
The text was updated successfully, but these errors were encountered:
Why you want to do this?
Can you give an example of case you want to do this?
Sorry, something went wrong.
This is usually a pattern that I see in another permissions packs.
For example, when I want to check if he has access to some of these two resources.
guard: user.create || post.create
In this case (above), you only need to have access to one of the resources to be allowed.
However, this (below) would need to have access to both resources to be allowed.
guard: user.create && post.create guard: user.create, post.create
Another operator would be NOT. It would only give permission if the value of user.create was false instead of true.
NOT
user.create
false
true
guard: !(user.create)
Really, this one I don't think would be very useful. However, separating the logic of AND and OR would help a lot.
AND
OR
No branches or pull requests
Can I use boolean operators in the guard's middleware?
In the example below, when I separe resources with commas, that means an
and
operator.What could I do to trigger them using another operators, like
or
ornot
.Something like this:
The text was updated successfully, but these errors were encountered: