Under security.yml
I added new role called ROLE_PUBLISHER
access_control:
- { path: ^/publisher/, roles: [ ROLE_PUBLISHER ] }
role_hierarchy:
ROLE_TC_ADMIN: [ ROLE_ALLOWED_TO_SWITCH ]
ROLE_PUBLISHER: [ ROLE_PUBLISHER_UNCONFIRMED ]
Role works fine, it is used on production env, but I just noticed that I cannot check in twig
if logged user has correct role.
This one works fine, I am getting 'user' word
{% if is_granted('ROLE_USER') %}'user'{% else %}''{% endif %}
This one does not work (always empty string), even I am logged in as publisher
{% if is_granted('ROLE_PUBLISHER') %}'publisher'{% else %}''{% endif %}
Is it possible that user has two roles ROLE_USER
and ROLE_PUBLISHER
and twig always checking the first one?