zendframework / zend-permissions-acl

BSD 3-Clause "New" or "Revised" License
60 stars 23 forks source link

Navigation ACL / accept doesn't work if an asserter is provided #19

Open GeeH opened 8 years ago

GeeH commented 8 years ago

This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7614 User: @ceadreak Created On: 2015-08-12T16:57:55Z Updated At: 2015-11-06T22:14:04Z Body I have an issue in an application to hide parts of menu if acl resource is not allowed for a role. I defined a member role with a resource platform.ticketing and a privilege access.

Acl is defined such as below :

    $this->allow('member', 'platform.ticketing', 'access', new HasTicketing());

HasTicketing is a simple asserter returning true if member can access or false if not.

If I remove asserter, everything works fine but the menu appears ...

On my navigation config :

    // ...
    [
        'label'     => 'Ticketing',
        'route'     => 'platform/ticketing',
        'resource'  => 'platform.ticketing',
        'privilege' => 'access',
    ],
    // ...

On navigation partial :

    // ...
    foreach($this->container->getPages() as $page) {
        if(!$page->isVisible() || !$this->navigation()->accept($page)) continue;
    // ...

In the Xdebug trace, resource and privilege are OK, but $accept = false. Acl works great for pages otherwise ...

Any idea for this issue ? Tks


weierophinney commented 4 years ago

This repository has been closed and moved to laminas/laminas-permissions-acl; a new issue has been opened at https://github.com/laminas/laminas-permissions-acl/issues/3.