简体   繁体   中英

Sonata User - Role security Access denied

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 ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM