Symfony2 - Sonata ACL cannot edit

I am working on a Symfony project where I need to manage roles. I want to use ACATA sonatas but cannot make it work.

A user with ROLE_CONTACT should be able to list, create and edit a user, but he can only list and add users.

I have completed the documentation here .

Here is my code.

security.yml

 role_hierarchy:
        ROLE_TRADUCTEUR:      [ROLE_USER]
        ROLE_CONTACT:
          - ROLE_SONATA_ADMIN
          - ROLE_SONATA_ADMIN_USER_STAFF
          - ...
    acl:
        connection: default 

services.yml

parameters:
#    parameter_name: value
    security.acl.permission.map.class: Sonata\AdminBundle\Security\Acl\Permission\AdminPermissionMap
    sonata.admin.security.mask.builder.class: Sonata\AdminBundle\Security\Acl\Permission\MaskBuilder

sonata_admin.yml (included in config.yml)

sonata_admin:
    templates:
        layout:  SonataAdminBundle::extend_layout.html.twig
    security:
        handler: sonata.admin.security.handler.acl
        # acl security information
        information:
            GUEST:    [VIEW, LIST]
            STAFF:    [EDIT, LIST, CREATE]
            EDITOR:   [OPERATOR, EXPORT]
            ADMIN:    [MASTER]

        # permissions not related to an object instance and also to be available when objects do not exist
        # the DELETE admin permission means the user is allowed to batch delete objects
        admin_permissions: [CREATE, LIST, DELETE, UNDELETE, EXPORT, OPERATOR, MASTER]

        # permission related to the objects
        object_permissions: [VIEW, EDIT, DELETE, UNDELETE, OPERATOR, MASTER, OWNER]

Could you help me? Thanks you

+4
source share

All Articles