Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony granting path access to multiple roles in security.yml

Hi I would like to be able to allow access to a path in security.yml based on the user either having ROLE_TEACHER, or ROLE_ADMIN.

According to the question in Multiple roles required for same url in symfony 2 the entry below should allow either role access.

- { path: ^/admin, roles: ROLE_ADMIN} - { path: ^/admin, roles: ROLE_TEACHER} 

However, this will only allow the top role access. Is there a way of having multiple role access to a single path?

like image 919
nmcilree Avatar asked Oct 18 '13 15:10

nmcilree


1 Answers

This is the way to go and what i'm using:

- { path: ^/admin, roles: [ROLE_ADMIN, ROLE_TEACHER] } 
like image 173
Udan Avatar answered Sep 24 '22 02:09

Udan