Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'spiffyjr/pr/navigation-throws-exception…

…-on-acl'
  • Loading branch information...
commit 4ee64b9278d206603d022896ac647bd92124caee 2 parents f2b4ac8 + a63a811
@akrabat akrabat authored
View
2  library/Zend/View/Helper/Navigation/AbstractHelper.php
@@ -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;
View
18 tests/Zend/View/Helper/Navigation/NavigationTest.php
@@ -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()
{
Please sign in to comment.
Something went wrong with that request. Please try again.