title: Understanding Symfony role permissions and templating
body: <p>I've inherited a Symfony 2.7.5 project that extensively uses groups through the default Symfony methods.</p>
  
  <p>I've got the need to create a few extra roles now and restrict various bits and pieces.</p>
  
  <p>After going through the Symfony 2 manual and various resources (including various answers here), it looks so simple - it basically says that since Symfony 2, the command should be:</p>
  
  <pre><code>{% if is_granted('ROLE_MY_NEW_ROLE') %}
  code here 
  {% endif %}
  </code></pre>
  
  <p>but I just couldn't get this working. After messing around for ages, I came up with the following:</p>
  
  <pre><code>{% set hasMyRole = is_granted('ROLE_MY_NEW_ROLE', moduleManager.module) %}
  {% if hasMyRole %}
  Stuff my role here...
  {% endif %}
  </code></pre>
  
  <p>which does work.</p>
  
  <p>This seems rather nasty and it was brute force and testing that got me here. I really don't think I have this right and was wondering if anyone can point me in the right direction, or, should I stick with what I have/has this project got a bad implementation of roles?</p>