Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

CakePHP Acl Plugin

Build Status Coverage Status License

A plugin for managing ACL in CakePHP applications.

Installing via composer

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require cakephp/acl

Then in your src/Application.php:

public function bootstrap()

Creating tables

To create the ACL requires tables, run the following Migrations command:

bin/cake migrations migrate -p Acl

Attaching the behavior

Add the Acl behavior to your table so it will automatically create an aco whenever a new record is saved:

public function initialize(array $config)

    $this->addBehavior('Acl.Acl', ['controlled']);

Updating the entity

Before you can start using the behavior, you MUST add the parentNode() method to the corresponding Entity file or the AclBehavior will not be able to determine the parent->child relationships. Also make make sure the method returns either null or a parent Model reference.

public function parentNode() {
    return null;

If things went well you should now see an entry appearing in the acos database table whenever you save a new record.

Running tests

Assuming you have PHPUnit installed system wide using one of the methods stated here, you can run the tests for the Acl plugin by doing the following:

  1. Copy phpunit.xml.dist to phpunit.xml
  2. Add the relevant database credentials to your phpunit.xml if you want to run tests against a non-SQLite datasource.
  3. Run phpunit