In my Synfony2 wep application, there is two different role that the same user can have. He can whether be an employee or a boss. So, I want to have a switch button the change role so the user have a different view on data. For example, has a Boss the user would see the progress of the work in a project and as a Employee he would see the work to be done from each member of the team in the same project. So basically, the boss would have privilege on some action and the employee on some others.
How should I do the switch between the roles? I was planning to have two different url for each roles /boss/todes
and employee/todos
. In some case, I would use the same twigs template (e.g. the listing of the todos). How do I do when I need to generate a URL such as /boss/todos/{id}
by always specifying the same route_name path('todo_show', {'id': id})
.
I think it is pretty similar to the _locale
parameter. Is it possible to create a custom parameter similar to _locale
in Symfony 2.3?
Thanks in advance !