Check ACL permissions of several users for an object
Asked Answered
C

1

6

I'm using Symfony Security/ACL component to check permissions of a group of "random" users for a given domain object.

$article = ...; // domain object
$users = ...; // array of users

$oid = ObjectIdentity::fromDomainObject($article);
$sids = array();

for ($users as $user) {
    $sids[] = UserSecurityIdentity::fromAccount($user);
}

$aclProvider = ...; // "security.acl.provider" service
$acl = $aclProvider->findAcl($oid, $sids);

However, I'm having trouble checking whether given permission is granted for a given user. How can I do that?

Clinton answered 9/12, 2012 at 23:24 Comment(0)
L
-1

I think you should use Acl Voter:

http://symfony.com/doc/current/cookbook/security/acl.html#checking-access

Lather answered 15/6, 2013 at 12:21 Comment(1)
That does not solve the problem of checking permissions for several users, only for the one sending the request.Casavant

© 2022 - 2024 — McMap. All rights reserved.