I’m using symfony 4 voters and love how it works to grant or deny permission to a controller method.
What I’m trying to achieve now is to check if user has permission to see a specific block in my twig view. I have a voter called Web:
I’d like to do {% if isGranted(‘Web’) %}{% endif %}
Is this possible? otherwise I’d like to get the result of my voter in a variable from the controller that ‘ill pass to the view without necessary denying access to the method/page.
Is this possible?
Thanks.
I suggest you export your block into an another template then you include it in your original template with the render function
then in MyController you can do :