Security ======== The security part is managed by a ``SecurityHandler``, the bundle comes with 2 handlers - ``sonata.admin.security.handler.acl`` : ACL and ROLES to handle permissions - ``sonata.admin.security.handler.noop`` : always returns true, can be used with the Symfony2 firewall The default value is ``sonata.admin.security.handler.noop``, if you want to change the default value you can set the ``security_handler`` to ``sonata.admin.security.handler.acl``. .. code-block:: yaml # app/config/config.yml sonata_admin: security_handler: sonata.admin.security.handler.acl The following section explains how to set up ACL with the ``FriendsOfSymfony/UserBundle``. ACL and FriendsOfSymfony/UserBundle ----------------------------------- If you want an easy way to handle users, please use : - https://github.com/FriendsOfSymfony/FOSUserBundle : handle users and groups stored in RDMS or MongoDB - https://github.com/sonata-project/SonataUserBundle : integrates the ``FriendsOfSymfony/UserBundle`` with the ``AdminBundle`` The security integration is a work in progress and has some known issues : - ACL permissions are immutables - Only one PermissionMap can be defined Configuration ~~~~~~~~~~~~~ Before you can use ``FriendsOfSymfony/FOSUserBundle`` you need to set it up as described in the documentation of the bundle. In step 4 you need to create a User class (in a custom UserBundle). Do it as follows: .. code-block:: php install ACL for sonata.media.admin.media - add role: ROLE_SONATA_MEDIA_ADMIN_MEDIA_EDIT, ACL: ["EDIT"] - add role: ROLE_SONATA_MEDIA_ADMIN_MEDIA_LIST, ACL: ["LIST"] - add role: ROLE_SONATA_MEDIA_ADMIN_MEDIA_CREATE, ACL: ["CREATE"] - add role: ROLE_SONATA_MEDIA_ADMIN_MEDIA_DELETE, ACL: ["DELETE"] - add role: ROLE_SONATA_MEDIA_ADMIN_MEDIA_OPERATOR, ACL: ["OPERATOR"] ... skipped ... If you try to access the admin class you should see the login form, just logon with the ``root`` user. Usage ~~~~~ Everytime you create a new ``Admin`` class, you should create ACL by using the command ``php app/console sonata:admin:setup-acl`` so the ACL database will be updated with the latest masks and roles informations.