Symfony2 security functions in Twig? How to check the user's role?

SymfonyTwig

Symfony Problem Overview


I have Symfony 2.0.9 standard edition installed with JMSSecurityBundle. Just wondering what functions are available to me in a Twig template to deal with users?

Specifically I want check to see if a user has the role ROLE_ADMIN.

Any help?

Thanks

Symfony Solutions


Solution 1 - Symfony

{% if is_granted('ROLE_ADMIN') %} ... {% endif %}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionChris TicknerView Question on Stackoverflow
Solution 1 - SymfonyKris WallsmithView Answer on Stackoverflow