I know that my title is not very clear. I explain me, I create a security:
security:
encoders:
Bundles\UserBundle\Entity\user: sha512
role_hierarchy:
ROLE_MENAGE: [ROLE_USER]
ROLE_EMPLOYE: [ROLE_ADMIN]
ROLE_GERANT: [ROLE_SUPER_ADMIN]
ROLE_INTERCOMMUNAL: [ROLE_GERANT]
providers:
main:
id: fos_user.user_provider.username
firewalls:
main:
pattern: ^/
anonymous: true
provider: main
form_login:
login_path: fos_user_security_login
check_path: fos_user_security_check
logout:
path: fos_user_security_logout
target: /login
remember_me:
key: %secret%
access_control:
- { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, roles: ROLE_MENAGE }
- { path: ^/resetting, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, roles: ROLE_MENAGE }
- { path: ^/EncoderDechet, roles: ROLE_EMPLOYE }
- { path: ^/VoirConteneurs, roles: ROLE_GERANT }
- { path: ^/GenererFacture, roles: ROLE_INTERCOMMUNAL }
- { path: ^/Statistique, roles: ROLE_GERANT }
Like you can see in this SECURITY.YML I define a role hierarchy. When I log In with a User who have : ROLE_EMPLOYE as role, I have can have access to /register. But this path must have as role : EMPLOYE, and it give me an 403 : access denied.
Can you explain me where I made a mistake ?