title: How to use roles in SonataAdminBundle
body: <p>I started to use <a href="http://sonata-project.org/bundles/admin/master/doc/index.html" rel="nofollow noreferrer">SonataAdminBundle</a> in a <strong>Symfony2.1</strong> application. I developed all the <code>Admin</code> classes and now I wish to add roles to prevent <em>view</em>, <em>list</em> and <em>edit</em> actions to such user groups (e.g. <em>non-admin users</em>).</p>
  
  <p>Notice that I don't use the <em>SonataUserBundle</em> (derived from <em>FOSUserBundle</em>) and I want to use the <code>sonata.admin.security.handler.role</code> security handler provided by the Sonata: ACL is too much powerful (and provides a lot of overhead) for my small project.</p>
  
  <p>My own <em>UserBundle</em> provides User class and Group class (the last used to specify the role of each user). The role hierarchy is provided in my <em>security.yml</em> file, e.g.:</p>
  
  <pre><code>security:
      role_hierarchy:
          ROLE_POST_AUTHOR:            ROLE_USER
          ROLE_ADMIN:                  [ ROLE_USER, ROLE_POST_AUTHOR]
          ROLE_SUPER_ADMIN:            [ ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ] 
  </code></pre>
  
  <p>Now, I configured the config.yml file by specifying the security handler</p>
  
  <pre><code>sonata_admin:
      security:
          handler: sonata.admin.security.handler.role
  </code></pre>
  
  <p>The <a href="http://sonata-project.org/bundles/admin/master/doc/reference/security.html" rel="nofollow noreferrer">official docs</a> are more focused on how using ACL and SonataUserBundle, so I don't know how to link my roles from <em>security.yml</em> with the SonataAdminBundle. </p>
  
  <p>PS: A similar question is: <a href="https://stackoverflow.com/questions/10911188/sonataadminbundle-security-roles">SonataAdminBundle Security roles</a>. </p>