title: role_hierarchy with Symfony2
body: <p>I have a big problem with my role_hierarchy,</p>
  
  <pre><code>security:
      role_hierarchy:
          ROLE_ADMIN:[ROLE_USER,ROLE_AUTHOR,ROLE_MODERATOR]
          ROLE_SUPER_ADMIN:[ROLE_ADMIN,ROLE_ALLOWED_TO_SWITCH]
  </code></pre>
  
  <p>with that, if i got the SUPER_ADMIN role, I will got the ROLE_AUTHOR, ROLE_MODERATOR, ROLE_USER AND ROLE_ADMIN. But my problem it's when I login on my website, if I check the profiler, i can see i got only the ROLE_SUPER_ADMIN, not the others roles, so, can you help me?</p>
  
  <p>my view (<code>base.html.twig</code>)</p>
  
  <pre><code>&lt;h3&gt;Blog&lt;/h3&gt;
  &lt;ul class="nav nav-pills nav-stacked"&gt;
      &lt;li&gt;&lt;a href="{{ path('dom_home') }}"&gt;Home Page&lt;/a&gt;&lt;/li&gt;
      {% if is_granted('ROLE_AUTHOR') %}
          &lt;li&gt;&lt;a href="{{ path('dom_add') }}"&gt;Add a post&lt;/a&gt;&lt;/li&gt;
      {% endif %}
      {% if is_granted('IS_AUTHENTICATED_FULLY') %}
          &lt;li&gt;&lt;a href="{{ path('fos_user_security_logout') }}"&gt;Logout&lt;/a&gt;&lt;/li&gt;
      {% else %}
          &lt;li&gt;&lt;a href="{{ path('fos_user_security_login') }}"&gt;login&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="{{ path('fos_user_registration_register') }}"&gt;register&lt;/a&gt;&lt;/li&gt;
      {% endif %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>my <code>security.yml</code> (app/config)</p>
  
  <pre><code>security:
      encoders:
          Symfony\Component\Security\Core\User\User: plaintext
          FOS\UserBundle\Model\UserInterface: sha512
  
      role_hierarchy:
          ROLE_ADMIN:       [ROLE_USER,ROLE_AUTHOR,ROLE_MODERATOR]
          ROLE_SUPER_ADMIN: [ROLE_ADMIN,ROLE_ALLOWED_TO_SWITCH]
  
      providers:
          in_memory:
              users:
                  user:  { password: userpass, roles: [ 'ROLE_USER' ] }
                  admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
          fos_userbundle:
              id: fos_user.user_manager
      firewalls:
          dev:
              pattern:  ^/(_(profiler|wdt)|css|images|js)/
              security: false
          login:
              pattern:   ^/(login$|register|resetting)
              anonymous: true
          main:
              pattern: ^/
              form_login:
                  provider:    fos_userbundle
                  remember_me: true
                  always_use_default_target_path: true
                  default_target_path: /dom/
              remember_me:
                  key:         %secret%
              anonymous:       false
              logout:          true 
  </code></pre>
  
  <p>edit:</p>
  
  <p>my view (base.html.twig)</p>
  
  <pre><code>&lt;h3&gt;Blog&lt;/h3&gt;
  &lt;ul class="nav nav-pills nav-stacked"&gt;
      &lt;li&gt;&lt;a href="{{ path('dom_home') }}"&gt;Home Page&lt;/a&gt;&lt;/li&gt;
      {% if is_granted('ROLE_AUTHOR') %}
          &lt;li&gt;&lt;a href="{{ path('dom_add') }}"&gt;Add a post&lt;/a&gt;&lt;/li&gt;
      {% endif %}
      {% if is_granted('IS_AUTHENTICATED_FULLY') %}
          &lt;li&gt;&lt;a href="{{ path('fos_user_security_logout') }}"&gt;Logout&lt;/a&gt;&lt;/li&gt;
      {% else %}
          &lt;li&gt;&lt;a href="{{ path('fos_user_security_login') }}"&gt;login&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="{{ path('fos_user_registration_register') }}"&gt;register&lt;/a&gt;&lt;/li&gt;
      {% endif %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>my security.yml (app/config)</p>
  
  <pre><code>security:
      encoders:
          Symfony\Component\Security\Core\User\User: plaintext
          FOS\UserBundle\Model\UserInterface: sha512
  
      role_hierarchy:
          ROLE_ADMIN:       [ROLE_USER,ROLE_AUTHOR,ROLE_MODERATOR]
          ROLE_SUPER_ADMIN: [ROLE_ADMIN,ROLE_ALLOWED_TO_SWITCH]
  
      providers:
          in_memory:
              users:
                  user:  { password: userpass, roles: [ 'ROLE_USER' ] }
                  admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
          fos_userbundle:
              id: fos_user.user_manager
      firewalls:
          dev:
              pattern:  ^/(_(profiler|wdt)|css|images|js)/
              security: false
          login:
              pattern:   ^/(login$|register|resetting)
              anonymous: true
          main:
              pattern: ^/
              form_login:
                  provider:    fos_userbundle
                  remember_me: true
                  always_use_default_target_path: true
                  default_target_path: /dom/
              remember_me:
                  key:         %secret%
              anonymous:       false
              logout:          true 
  </code></pre>
  
  <p>please answer :)</p>