Take the 2-minute tour ×

I have a user based system. When user has 1 role my system works well. I have no clue how do i take into consideration when user should have multiple roles. How do i check rule when applying for a page.?

share|improve this question
I suggest you add another method to your code. –  Sherlock Oct 15 '12 at 9:53
In other words: what answer do you expect here? –  Sherlock Oct 15 '12 at 9:53
@Robin v. G. - Like how should be the scenario handled when user has multiple roles. –  Hacker Oct 15 '12 at 9:56
if ($user->hasRole('ROLE_A') && $user->hasRole('ROLE_B'))...? –  RobMasters Oct 15 '12 at 10:01
add comment

1 Answer

I suggest you move away from $user->hasRole(foo). It makes it difficult to change role permissions dynamically. You could as the ACL system questions like $this->acl->isAllowed($user, 'edit_page'). If the ACL system checks the roles this user has, and one of the roles grants permission to do a certain action, it can return this permission.

share|improve this answer
add comment

Your Answer


