Search code examples
phpzend-frameworkzend-acl

List Rules in Zend_ACL


I'm using zend_acl to manage ACL lists in my web application. To be able to show a 'Manage Permissions' Dialogue I need a possibility to get defined rules for the following combinations:
- rules set for a specific role on a specific resource
- all rules that have been set for roles on a specific resource (who has which rights on this)
- all rules that have been set for a specific role on any resource (which rights does the role have)
To be able to display a complete list there must always be an additional list with rules that have been inherited from parent roles/resources.

Do you have any idea how to solve this?


Solution

  • You can retrieve all the roles and the resources this way

    $acl = new Application_Model_Acl();
    $acl->getRegisteredRoles(); // roles instances
    $acl->getRoles(); //array
    $acl->getResources(); //array
    

    I think you have to extend Zend_Acl for retrieve the "registered resources per role".

    If the project is so "extended", usually, I generate the Acl dinamically from database, but I created a Zend_Acl extension by my side