Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

twig

symfony

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

like image 700
Chris Tickner Avatar asked Jan 10 '12 20:01

Chris Tickner


1 Answers

{% if is_granted('ROLE_ADMIN') %} ... {% endif %} 
like image 159
Kris Wallsmith Avatar answered Sep 22 '22 08:09

Kris Wallsmith