In views, I can use
if ($view['security']->isGranted('ROLE_ADMIN')) :
To check if the user has a certain role. But what about objects?
For example: when a user is viewing his/her post, I want to show an edit/delete button
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In a twig template you can use the
is_grantedfunction, see Access control in templates for more information.To apply it to ACL you can just do: