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?
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With