Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-11-2008, 03:06 AM
Junior Member
 
Join Date: Aug 2008
Posts: 24
Default where do I put my acl files?

I have a basic MVC application set up. One of my controllers is an AuthController and I have been able to set up a login function. My next step is setting up some access roles and I have read a few tutorials and took a look at the documentation, so I have an idea of how to write the files I need. However I am not sure about where to put the files. Should they just be hanging out loose in the application folder? Do they go in with the models or do they need their own folder? I seem to be missing the big picture of how acl fits into my application. Can anyone help, or maybe direct me to a tutorial that explains it. Most of the ones I have seen tell you all about the code, but not about where to put it so it can be accessed.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-16-2008, 01:24 AM
wrs's Avatar
wrs wrs is offline
Member
 
Join Date: Sep 2008
Posts: 42
Default

If you are refering to your initial setup of your Acl object ( calls to addRole, addResource, allow/deny etc ) then it is really up to you where you place them.

Of course, they'll need to be executed in time for when they are required. Doing this within the bootstrap would seem a good choice.

Because i've gotten in to the habit of extending pretty much everything ZF offers, and the fact that my bootstrap is becoming very bloated, i opted to extend the Zend_Acl class and place my addRole() etc calls within the constructor.

so my bootstrap contains:

PHP Code:
$acl = new WN_acl;
Zend_Registry::set('acl'$acl); 
and my custom Acl class:

PHP Code:
class WN_Acl extends Zend_Acl {
    public function 
__construct(){
        
$this->addRole(new Zend_Acl_Role('guest'))
            ->
addRole(new Zend_Acl_Role('member'), 'guest');

        
$this->addResource(new Zend_Acl_Resource('index'))
            ->
addResource(new Zend_Acl_Resource('account'));

        
$this->allow('guest', Array('index''account'))
            ->
deny('guest''account', Array('logout','profile'))
            ->
allow('member''account', Array('logout''profile'))
            ->
deny('member''account', Array('login''register'));
    }
}; 
Actual contents of WN_Acl might not be correct, but you should get the idea.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-02-2008, 10:25 PM
Junior Member
 
Join Date: Oct 2008
Posts: 3
Default acl location

I put the acl class file in application/models

in the bootstrap file i have this section

Code:
set_include_path('.' . PATH_SEPARATOR . '../library/'
. PATH_SEPARATOR . '../application/models'
. PATH_SEPARATOR . '../application/controllers/plugins'
. PATH_SEPARATOR . '../application/controllers/helpers'
. PATH_SEPARATOR . get_include_path());
You can put the acl anywhere as long as it is indicated in the include path:

example: if you want the acl file to be application/acl/myAcl.php

Code:
set_include_path('.' . PATH_SEPARATOR . '../library/'
. PATH_SEPARATOR . '../application/models'
. PATH_SEPARATOR . '../application/controllers/plugins'
. PATH_SEPARATOR . '../application/acl'
. PATH_SEPARATOR . '../application/controllers/helpers'
. PATH_SEPARATOR . get_include_path());
if anyone knows a better placement of the acl file, please share
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-06-2008, 04:27 AM
Senior Member
 
Join Date: Jun 2008
Location: Florida
Posts: 108
Default

I place the application-level acl file in:

application\NameOfApplication\config\acl.ini
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:15 AM.