Creating a resource in
Zend_Acl is very simple.
Zend_Acl provides the resource,
Zend_Acl_Resource_Interface, to facilitate creating resources in
an application. A class need only implement this interface, which consists of a single
recognize the object as a resource. Additionally,
Zend_Acl_Resource is provided by
as a basic resource implementation for developers to extend as needed.
Zend_Acl provides a tree structure to which multiple resources
can be added. Since resources are stored in such a tree structure, they can be
organized from the general (toward the tree root) to the specific (toward the tree
leaves). Queries on a specific resource will automatically search the resource's
hierarchy for rules assigned to ancestor resources, allowing for simple inheritance of
rules. For example, if a default rule is to be applied to each building in a city, one
would simply assign the rule to the city, instead of assigning the same rule to each
building. Some buildings may require exceptions to such a rule, however, and this can
be achieved in
Zend_Acl by assigning such exception rules to
each building that requires such an exception. A resource may inherit from only one
parent resource, though this parent resource can have its own parent resource, etc.
Zend_Acl also supports privileges on resources (e.g., "create",
"read", "update", "delete"), so the developer can assign rules that affect all
privileges or specific privileges on one or more resources.