Closed phansys closed 5 years ago
Hey Javier, nothing to do with your issue, but can you please check the sf slack? https://symfony-devs.slack.com
Regarding your issue, why not, it might be useful in some situations where you have many properties and you want to hide some of them and they are not sequential. Might spare the user from writing a bunch of if statements.
Feature Request
Allow the following methods to restrict their contents based on a new "role" option passed in their 3rd argument:
ListMapper::add()
DatagridMapper::add()
ShowMapper::add()
ShowMapper::with()
ShowMapper::tab()
FormMapper::add()
FormMapper::with()
FormMapper::tab()
I think the easiest approach to achieve this behavior is to extend this condition https://github.com/sonata-project/SonataAdminBundle/blob/64b83e290566dc609a7a30d6a419c1359430dfc9/src/Form/FormMapper.php#L59 with the following check
So, if the authenticated user doesn't have the required role, the call to any of these methods will be ignored: