Why an action helper, why not a plugin? -- Regards, Vladas Diržys Tel.: +370 620 69020 www.dirzys.com
On Thu, Jul 16, 2009 at 14:24, Matthew Weier O'Phinney <[email protected]>wrote: > -- J DeBord <[email protected]> wrote > (on Thursday, 16 July 2009, 09:30 AM +0200): > > I created a front controller plugin for checking my ACL against the > user's > > role. It first checks Zend_Auth for an identity. If an identity exists, > it > > grabs the identity's role. If no identity exists, it uses 'guest' as the > > default role. I hooked into the preDispatch() method of the front > controller > > plugin. > > > > This works, except that I've lost my "page not found functionality". So > I get > > "resource not found" or "not authorized" message when requests for non > > existance controllers or actions are made. > > > > Would it be better to have the controllers extend a "BaseController" that > does > > the ACL checks in the init() method? > > > > What is the preferred way or best practice for running the ACL checks? > > Use an action helper with a preDispatch() hook, and register it in your > bootstrap. :) > > -- > Matthew Weier O'Phinney > Project Lead | [email protected] > Zend Framework | http://framework.zend.com/ >
