0

我在尝试为特定对象批量加载 ACL 时遇到问题(在下面的示例中,它是 Account 类。)

如果我使用以下代码,即使 acl_object_identities 已填充,应填充的返回数组也是空的。我错过了什么?

        $oids = array();
    foreach ($accounts as $account) {
        $oid = ObjectIdentity::fromDomainObject($account);
        $oids[] = $oid;
    }

    $aclProvider->findAcls($oids);

$accounts 保存使用 findAll() 找到的实体数组。

4

1 回答 1

0

好吧,看起来 ACL 最终被拉出,关键是迭代跟进以查看哪些权限已到位。

foreach ($accounts as $account) {
    if ($securityContext->isGranted('EDIT', $account)) {
        // Granted, do something with it
    } else {
        // Not Granted
    }
}

所以,似乎一切都在设计。

于 2012-07-14T19:38:53.537 回答