Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the ACLs for another user than the current logged one in Symfony2?

I'm building a web application using Symfony2. I've been implementing the ACL modules and it worked perfectly, but stumbled on an issue when trying to make a pannel to manage rights.

So I got as user which can create a project and add "participants" on his project. The participants can have three different access type which are masks from the mask builder MASK_VIEW, MASK_EDIT, MASK_OPERATOR. Using the ProblematicAclManagerBundle we can easily add access to these using doing this :

$this->aclManager->addObjectPermission($project, $mask, $user);

The thing is that when you want to edit the project, you have to be able to list the users with their current access rights. The function isGranted can get you the users right for the current logged in user, but not for other users. Compared to the addXXXX functions where there are three arguments, the isGranted only have two, the secured object and the mask. Thus you cannot find the right for another user with this function.


Is there some sort of way to get the rights of other user built-in? Or do I have to build my own SQL queries to extract the data from the acl tables?

like image 773
Hugo Dozois Avatar asked Nov 04 '22 05:11

Hugo Dozois


1 Answers

Maybe you can try to put another token in the security context, linked to another user:

$securityContext->setToken(new Token($user2));
$securityContext->isGranted('test', $object);
like image 53
Florian Klein Avatar answered Nov 15 '22 08:11

Florian Klein