Skip to content

Commit

Permalink
Fix ACL editor
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Sep 13, 2013
1 parent 3d9d5d4 commit 56d6929
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions Controller/CRUDController.php
Expand Up @@ -724,20 +724,22 @@ public function exportAction(Request $request)
/**
* Gets ACL users
*
* @return array
* @return \Traversable
*/
protected function getAclUsers()
{
$aclUsers = array();

$userManagerServiceName = $this->container->getParameter('sonata.admin.security.acl_user_manager');
if ($userManagerServiceName !== null && $this->has($userManagerServiceName)) {
$userManager = $this->get($userManagerServiceName);

if (method_exists($userManager, 'findUsers')) {
return $userManager->findUsers();
$aclUsers = $userManager->findUsers();
}
}

return array();
return is_array($aclUsers) ? new \ArrayIterator($aclUsers) : $aclUsers;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Security/Handler/AclSecurityHandler.php
Expand Up @@ -166,10 +166,10 @@ public function getObjectAcl(ObjectIdentityInterface $objectIdentity)
/**
* {@inheritDoc}
*/
public function findObjectAcls(array $oids, array $sids = array())
public function findObjectAcls(\Traversable $oids, array $sids = array())
{
try {
$acls = $this->aclProvider->findAcls($oids, $sids);
$acls = $this->aclProvider->findAcls(iterator_to_array($oids), $sids);
} catch (\Exception $e) {
if ($e instanceof NotAllAclsFoundException) {
$acls = $e->getPartialResult();
Expand Down
4 changes: 2 additions & 2 deletions Security/Handler/AclSecurityHandlerInterface.php
Expand Up @@ -67,13 +67,13 @@ public function getObjectAcl(ObjectIdentityInterface $objectIdentity);
*
* @abstract
*
* @param array $oids an array of ObjectIdentityInterface implementations
* @param \Traversable $oids a collection of ObjectIdentityInterface implementations
* @param array $sids an array of SecurityIdentityInterface implementations
*
* @throws \Exception
* @return \SplObjectStorage mapping the passed object identities to ACLs
*/
public function findObjectAcls(array $oids, array $sids = array());
public function findObjectAcls(\Traversable $oids, array $sids = array());

/**
* Add an object owner ACE to the object ACL
Expand Down
4 changes: 2 additions & 2 deletions Util/ObjectAclManipulator.php
Expand Up @@ -23,14 +23,14 @@ abstract class ObjectAclManipulator implements ObjectAclManipulatorInterface
*
* @param OutputInterface $output
* @param AdminInterface $admin
* @param array $oids an array of ObjectIdentityInterface implementations
* @param \Traversable $oids a collection of ObjectIdentityInterface implementations
* @param UserSecurityIdentity $securityIdentity
*
* @throws \Exception
*
* @return array [countAdded, countUpdated]
*/
public function configureAcls(OutputInterface $output, AdminInterface $admin, array $oids, UserSecurityIdentity $securityIdentity = null)
public function configureAcls(OutputInterface $output, AdminInterface $admin, \Traversable $oids, UserSecurityIdentity $securityIdentity = null)
{
$countAdded = 0;
$countUpdated = 0;
Expand Down

0 comments on commit 56d6929

Please sign in to comment.