2
votes

I'm using SonataUserBundle and I'm trying to give LIST/EDIT access to some users.

config.yml

#...
sonata_admin:
    security:
        handler: sonata.admin.security.handler.role
#...

I can see the roles ROLE_SONATA_USER_ADMIN_USER_* listed in admin.

security.yml

security:
    access_decision_manager:
        strategy: unanimous
    #...
    role_hierarchy:
        #...
        ROLE_EDIT_USER:
            - ROLE_SONATA_USER_ADMIN_USER_LIST
            - ROLE_SONATA_USER_ADMIN_USER_EDIT
        #...

But ROLE_EDIT_USER doesn't give access to User Admin.

I have no firewall rule for sonata.
If I use the handler sonata.admin.security.handler.noop I'm getting access, which proves (I think) that the access is actually denied by sonata.

What can deny me access to ROLE_EDIT_USER ?

1

1 Answers

2
votes

Ok I didn't see I had also ROLE_SONATA_ADMIN_USER_* listed in admin, I don't understand why.

So I had to set

    ROLE_EDIT_USER:
        - ROLE_SONATA_ADMIN_USER_LIST
        - ROLE_SONATA_ADMIN_USER_EDIT

instead

Sometimes Symfony seems to me so complicated for simple things...

I spend 10x less time configuring same things with Django for example.
Even if that is more related to Sonata than Symfony