Persisting Zend Framework ACL Lists
Asked Answered
S

4

10

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.

Sweeping answered 1/3, 2010 at 4:27 Comment(0)
V
4

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

Vaillancourt answered 1/3, 2010 at 5:41 Comment(0)
D
2

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 )
                               ));
Denticulation answered 2/3, 2010 at 6:42 Comment(0)
B
1

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

Benito answered 2/3, 2010 at 0:48 Comment(1)
I'd use a database if you need your users to be able to create/edit roles, and something static like a config file if they're static.Benito
C
1

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.

Costar answered 17/12, 2015 at 21:54 Comment(1)
You right, when I asked this question 5 years ago I didn't specify what sort of persistence was sought. I wanted to know if I needed to seek a specific sort of persistence myself, or if Zend had a system for handling that for me.Sweeping

© 2022 - 2024 — McMap. All rights reserved.