Share on Google+Share on Google+

Zend ACL

In this tutorial we will study about Zend ACL of PHP, basic concepts of Zend ACL, what is role, resource are discussed in this tutorial. This is the first episode of the series subsequent pages will discuss on other and advance topic.

Zend ACL:


Full form of ACL is Access Control List, it is a lightweight and flexible method to implement privilege management system. ACL can be utilized by an application to control access to any object.

In ACL both resource and role are objects, the accessibility of resource is controlled and role may request access to a Resource.   We can simply consider the resource as our personal things like mobile, laptop etc. Certainly you wont give permission to any body to access those.


In Zend_Acl creation of resource is simple, Zend_Acl_Resource_Interface is use to create resources in an application. One class will implement the interface and it will consists of a single method called getResourceId() which is used to recognize the object as a resource.

Zend_Acl follows a tree like structure in which multiple resources can be added. Resources are stored in such a tree structure and these can be organized from the root to leaves. Queries on a specific resource will search for resource's hierarchy. This concept can be clear from a very easy example that if we want to implement a rule to a state then we can select the state itself instead of selecting each district or city. We can also implement some exception for any particular city or district, if needed. One resource may inherit from one parent only.

Zend_Acl  supports several privileges on resources like read, write, read, update, delete etc., with the help of this feature developer can assign rules on one or more than one resources.


Like resources creating a role is equally important. Every role must implement Zend_Acl_Role_Interface In this interface there is only one method exists called getRoleId(). In Zend Framework a role may inherit one or more than one role. A role may belong to many parent roles and if we need to implement a rule to the parent roles then we will not worry to implement that rule to the child rule.

The ability to inherit features from multiple parents is useful but at the same time it leads us to some sort of ambiguity as well. But ZF is capable of handling this problem.




Posted on: April 21, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null