Answer the question
In order to leave comments, you need to log in
Easy admin. How to check the path?
Good afternoon.
I am mastering Symfony 5. I am making an admin panel based on Easy admin. When you switch to viewing the entity, the address bar in the browser looks like this:
sf/admin/?entity=Product&action=list&menuIndex=2&s...
I.e. if Product is replaced by User, there will be a transition to the User entity. Moreover, you can even enter:
sf/admin/?entity=Product&action=show&menuIndex=2&s...
B by changing show to edit, you can easily edit your data. The system has a system of roles, so such actions are not allowed. Question: where and how is the best way to check the address bar parameters, analyze them and, if necessary, make a redirect. Or is Easy admin not very suitable for such conditions and does it make sense to switch to Sonata? Thanks in advance.
Answer the question
In order to leave comments, you need to log in
EasyAdmin controllers are quite simple, you just inherit from EasyAdminController and name your controller like so: EntityName
+ Controller
, so for User it will be UserController
.
And for your controllers, as elsewhere in Symfony, you can use your own roles, like this:
/**
* @Security("is_granted('ROLE_CAN_EDIT_USER')")
*/
class UserController extends EasyAdminController
Read more: item_permission
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question