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

Commit

Permalink
Merge remote-tracking branch 'spiffyjr/pr/navigation-throws-exception…
Browse files Browse the repository at this point in the history
…-on-acl'
  • Loading branch information
akrabat committed Jan 27, 2012
4 parents 4e62a6d + a9d9490 + aed9f65 + 874d8c5 commit d50c975
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Helper/Navigation/AbstractHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ protected function _acceptAcl(AbstractPage $page)

if ($resource || $privilege) {
// determine using helper role and page resource/privilege
return $acl->isAllowed($role, $resource, $privilege);
return $acl->hasResource($resource) && $acl->isAllowed($role, $resource, $privilege);
}

return true;
Expand Down
18 changes: 18 additions & 0 deletions test/Helper/Navigation/NavigationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ public function testHelperEntryPointWithContainerParam()
$this->assertEquals($this->_helper, $returned);
$this->assertEquals($this->_nav2, $returned->getContainer());
}

public function testAcceptAclShouldReturnGracefullyWithUnknownResource()
{
// setup
$acl = $this->_getAcl();
$this->_helper->setAcl($acl['acl']);
$this->_helper->setRole($acl['role']);

$accepted = $this->_helper->accept(
new \Zend\Navigation\Page\Uri(array(
'resource' => 'unknownresource',
'privilege' => 'someprivilege'
),
false)
);

$this->assertEquals($accepted, false);
}

public function testShouldProxyToMenuHelperByDeafult()
{
Expand Down

0 comments on commit d50c975

Please sign in to comment.