Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/3513' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Jan 22, 2013
2 parents 78a9131 + d2df3f2 commit 16f6088
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,11 @@ public function setRule($operation, $type, $roles = null, $resources = null,
$resources = array();
foreach ($resourcesTemp as $resource) {
if (null !== $resource) {
$children = $this->getChildResources($this->getResource($resource));
$resourceObj = $this->getResource($resource);
$resourceId = $resourceObj->getResourceId();
$children = $this->getChildResources($resourceObj);
$resources = array_merge($resources, $children);
$resources[$resource] = $this->getResource($resource);
$resources[$resourceId] = $resourceObj;
} else {
$resources[] = null;
}
Expand Down
11 changes: 11 additions & 0 deletions test/AclTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1328,4 +1328,15 @@ public function testAclResourcePermissionsAreInheritedWithMultilevelResourcesAnd
$this->assertFalse($this->_acl->isAllowed('guest', 'post_1', 'comment'));
$this->assertFalse($this->_acl->isAllowed('guest', 'post_2', 'comment'));
}

public function testSetRuleWorksWithResourceInterface()
{
$roleGuest = new Role\GenericRole('guest');
$this->_acl->addRole($roleGuest);

$resourceFoo = new Resource\GenericResource('foo');
$this->_acl->addResource($resourceFoo);

$this->_acl->setRule(Acl\Acl::OP_ADD, Acl\Acl::TYPE_ALLOW, $roleGuest, $resourceFoo);
}
}

0 comments on commit 16f6088

Please sign in to comment.