Prev | Current Page 193 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

Retrieve from registry.>
(annotation) <#2. Iterate over all the roles.>
(annotation) <#2. Only add role if it doesn??™t already exist..>
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
As we have already explored Zend_Config, it comes as no surprise how easy it is to retrieve the data from
the config object using a foreach loop. For each role, we check that it isn??™t already added and then create a new
Zend_Acl_Role and add it to this object. The Acl object is going to be used to check permissions for every
action and so we can create it in the bootstrap.
An especially tricky aspect is ensuring that we don??™t need to load the Acl object with information about
every controller and action. The main issues are maintenance and performance. Maintaining a list of
controllers independently of the actual controller class files will result in inaccuracies. We also do not want to
spend the time and memory loading the Acl with rules that will never be required as this is a needless
performance hit.
6.4.3 Checking the Zend_Acl Object
With these requirements in mind, the correct place to implement Acl checking is as an action helper. An action
helper ties into the MVC dispatch system at the controller level and allows us to check the Acl rules before the
controller??™s preDispatch() function is called.


Pages:
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
botox Kraków wyświetlacz xperia Wczasy nad morzem baseny ogrodowe tłumacz niemieckiego