symfony2 access_control无法正常工作

时间:2015-12-31 14:31:02

标签: symfony security roles access-control role

symfony2 access_control角色无法正常工作:(。 当我应用角色' ROLE_USER API'在access_control API上不起作用,但是当我应用' ROLE_API'直接access_control他的工作正常

   security:
    encoders:
        FOS\UserBundle\Model\UserInterface: md5

    role_hierarchy:
        ROLE_USER_API:    [ROLE_API]
        ROLE_ADMIN:       [ROLE_USER]
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

    # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
    providers:
        fos_userbundle:
            id: fos_user.user_provider.username       

    firewalls:

        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        api:
            pattern: ^/api                             
            fos_oauth: true                           
            stateless: true                            
            anonymous: false                           

        customer_order:
            pattern: ^/customer-order
            fos_oauth: true
            stateless: true
            anonymous: false

    access_control:
        - { path: ^/api, roles: ROLE_USER_API }

0 个答案:

没有答案