This screencast covers the usage of Zend_Acl in combination with Zend_Auth. Zend_Acl will be used to implement a static “Access Control List” in the existing sample application which was created in the Zend_Auth screencast. At the bottom of this page you find the sources and relevant links.
- Download sources used in the screencast (without Zend Framework)
- Download Zend Framework
- Zend_Acl Documentation
- Plugins (Zend_Controller) Documentation
Screencast licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.
Tags: PHP, screencast, Zend Framework, Zend_Acl


















August 28th, 2008 at 9:10 pm
Thank you so much for this very understandable screencast. It should be added to the zend framework official documentation!
I’m on the watchout for more like these!
August 28th, 2008 at 9:22 pm
Thank you for your feedback. More will follow soon.
September 20th, 2008 at 1:23 pm
Thank you so so so so much , I`m practitioner developer and I should understand how ZF works better , u gave me such a nice clue
October 20th, 2008 at 4:48 pm
Thank you very much. This is a really good tutorial…
But how would the My_Controller_Plugin_Acl’s preDispatch()-method change if I have a site that does also have modules.
So for exampla I have the default-module with two actions:
1. IndexAction - everybody can access this
2. MemberAction - just Members can access this
And a CMS-module with some actions, but this is just for admins.
I guess that the parameters whithin call to $asl->isAllowed() would change. But to what? Do I have to check for modules and contollers?
October 21st, 2008 at 8:45 am
I named my resources like my controllers. You can change that to a naming scheme like “modulename_controllername”.
The plugin would then change to this:
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
if (Zend_Auth::getInstance()->hasIdentity())
{
$role = Zend_Auth::getInstance()->getStorage()->read()->role;
}
else
{
$role = 'guest';
}
$acl = new My_Acl();
if (!$acl->isAllowed(
$role,
$request->getModuleName() . '_' . $request->getControllerName(),
$request->getActionName()
))
{
throw new Zend_Exception('Access Denied!');
}
}
}
October 21st, 2008 at 11:28 am
Thank you very much for this quick response.
October 21st, 2008 at 8:40 pm
Are you planning another screencasts for other components, I think Zend_Lucene and Zend_Translate would be great.
Also this is great tutorial, thank you for your efforts.
October 21st, 2008 at 10:34 pm
Yes, new screencasts will follow as soon as my company’s newest project is up and running. Topics will probably be Zend_Translate with gettext and Continuous Integration with phpUnderControl.
November 24th, 2008 at 11:41 am
Hi,
I really rarely write a comment but i think you have earned it!
Thanks for this really great tutorial!
It’s really easy now^^ And your debate is really good, also for “not-english-speeking-persons”
Thanks allot!
January 2nd, 2009 at 7:31 am
This is a very excellent screencast!! Thanks so much for providing a useful example with clear explanations as to why you are doing each step and taking nothing for granted. I look forward to you future screencasts!
Thanks!
-Mike