M
M
mytosterq20202019-06-09 09:18:27
Laravel
mytosterq2020, 2019-06-09 09:18:27

Laravel. Authorization, how to correctly register rights (Gate)?

Hello. Question about authorization
I have a public part (online store) and an administrative part.
And the complex logic with access rights, before registering rights (Gate::...), I must understand in which part of the application the user is located.
Or he is in the administrative, then one logic, if in the online storefront - another logic.
The question is, how can I do it better?
The first thing that came to mind is that it can resolve at the middleware level, tie all administrative routers into middleware (example app:admin)
and register Gate rights inside. For the online storefront app:shop.
But, how correct is it to register access rights in middleware?
What other possibilities are there to implement this?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2019-06-14
@dlnsk

It seems to me that the problem is that you are using Gate, and it provides only permissions, and no roles. Try my module, it adds roles to Gate:
Laravel 5. Hierarchical RBAC for the smallest

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question