Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persisting Zend Framework ACL Lists

Does the Zend Framework (or applications built using Zend_Application) provide any mechanism for persisting ACL lists, or is that detail left to the individual system/application developer?

Most of the examples I see online involve setting up your ACL rules in code. I'm curious if there's any standard/preferred way to save these rules into a database and/or file-system and then automatically load them.

like image 323
Alan Storm Avatar asked Mar 01 '10 04:03

Alan Storm


4 Answers

If the ACL is complex but static you could try caching your ACL using Zend_Cache

$cache = Zend_Cache::factory( 'File', 'File',
                                 array( 'automatic_serialization' => true,
                                        'master_file' => 'MyACL.php' ),
                                 array( 'cache_dir' => CACHE_PATH )
                               ));
like image 23
Steve Avatar answered Nov 17 '22 15:11

Steve


You might be interested in this Zend_Application resource and corresponding config from Joe Gornick: http://gist.github.com/249442

like image 38
David Snabel-Caunt Avatar answered Nov 17 '22 17:11

David Snabel-Caunt


Morning,

thats the part of the Framework User. We are storing our Acl inside of .ini or .xml files. On complex projects we are altough useing an Databasetable to store roles and resources.

There is a very good example on Zend DevZone for using acl with database.

Zend ACL with Database

like image 105
opHASnoNAME Avatar answered Nov 17 '22 15:11

opHASnoNAME


You haven't specified what kind of persistence is sought. For session-term persistence, you may store the ACL registry that you built (Zend_Acl object) in the session, or the Zend Registry.

I also advise to build it at logintime, or in a one-off fashion of some kind, to avoid overloading the processing of every page.

like image 1
Fabien Haddadi Avatar answered Nov 17 '22 17:11

Fabien Haddadi