Pages

Monday, August 20, 2012

ACL Plugin for CakePHP 2.0


This plugin is such an interface allowing to manage permissions of your application's users and roles.

1. Download latest CakePHP latest stable in CakePHP.org.

2. Install CakePHP see how: Install CakePHP 2.x in Ubuntu.

3. Setup a Simple Acl Controlled Application follow instruction here : Simple  Acl Controlled Application , part 1 only.

4. Download ACL Plugin for CakePHP 2.1

ACL Plugin Installation
  • copy the folder acl in your folder /app/plugins
  • configure the admin route (see http://book.cakephp.org/2.0/en/development/routing.html#prefix-routing)
  • copy the parameters found in Acl/Config/bootstrap.php in your file /app/Config/bootstrap.php or load the plugin with its own bootstrap.php file (CakePlugin::load('Acl', array('bootstrap' => true));)
see more: ACL Plugin Installation

 5. In your bootstrap.php located in your cakefolder/app/Plugin/Acl/Config/bootsrap.php. If you use groups (if you use database in in simple acl controlled application)  change 'Role' into 'Group'

Configure :: write('acl.aro.role.model', 'Role');



or just download this : CakePHP 2.2.1 with ACL Plugin Installed




2 comments:

  1. A quick resolution to these errors:

    Strict (2048): Declaration of AclManagerComponent::initialize() should be compatible with Component::initialize(Controller $controller)

    ...is to change the initilize statements to this:
    public function initialize(Controller $controller)

    ...in both the AclManagerComponent and AclReflectorComponent. That then makes these component mirror the core Cake component initialize statement.

    ReplyDelete
  2. A quick resolution to these errors:

    AclNode::node() - Couldn't find Aro node identified by "Array ( [Aro0.model] => Group [Aro0.foreign_key] => 1 )

    If you have existing groups.. delete all or empty the groups table and create again /groups/add .

    ReplyDelete