coopTilleuls / CoopTilleulsAclSonataAdminExtensionBundle

ACL list filtering for SonataAdmin
http://les-tilleuls.coop
MIT License
45 stars 21 forks source link

EDITOR role not working #29

Open lukepass opened 6 years ago

lukepass commented 6 years ago

Hello, I am trying to use this bundle but it just hides ALL the items from the list except the items created by the owner, what am I doing wrong?

config.yml

sonata_admin:
    security:
        handler: sonata.admin.security.handler.acl

        role_admin: ROLE_ADMIN
        role_super_admin: ROLE_SUPER_ADMIN

        # 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]

security.yml

security:
    role_hierarchy:
        ROLE_ADMIN:
            - ROLE_USER
            - ROLE_SONATA_ADMIN
            - ROLE_APP_ADMIN_PRODUCT_FAMILY_EDITOR
            - ROLE_APP_ADMIN_PRODUCT_EDITOR
        ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
        #SONATA:
            #- ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT  # if you are using acl then this line must be commented

    # https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

When I log in as a ROLE_ADMIN I see the product family list empty except for the items I created myself.

Thanks.

lukepass commented 6 years ago

I noticed that if I give the user the ROLE_APP_ADMIN_PRODUCT_EDITOR directly instead of the ROLE_ADMIN, the filters are working correctly. Maybe a problem with role hierarchy?