Replies: 1 comment
-
Still interested how gates/policies plays along with permissions in practice. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Not sure when I should define a gate and when a permission. It looks like that everything can be handled via permissions, but it would be great to have some guidance how to organise all of this. As it looks like I could just drop gates and policies, though it feels wrong.
My current requirements:
My approach was to handle each named route with separate Gate. New route, new gate. So gates file is the same size as routes.
Manage resources via Policy
Manage custom view widgets via Policies or gates (depends if it requires a resource)
Each gate and policy just does a proxy to hasAccess: " Gate::define('handle-paypal', fn (User $user) => $user->hasAccess('handle-paypal'));".
My approach feels a bit wrong. It's questionable why orchid hasn't endorsed Policy/Gate way to do it, but instead introduced new "permissions" concept. It does not look any different from gate.
Can you share your way how you manage this? Would be great to have cons/pros list of it.
Beta Was this translation helpful? Give feedback.
All reactions