PHPackages                             rogermaciel/cakephp-acl-manager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. rogermaciel/cakephp-acl-manager

ActiveCakephp-plugin[Authentication &amp; Authorization](/categories/authentication)

rogermaciel/cakephp-acl-manager
===============================

AclManager plugin for CakePHP 3.x

1.0(6y ago)05MITPHPPHP &gt;=5.4.16

Since Nov 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/rogermaciel/cakephp-acl-manager)[ Packagist](https://packagist.org/packages/rogermaciel/cakephp-acl-manager)[ Docs](https://github.com/rogermaciel/cakephp-acl-manager)[ RSS](/packages/rogermaciel-cakephp-acl-manager/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (2)Used By (0)

CakePHP 3.x Acl Manager
=======================

[](#cakephp-3x-acl-manager)

Installation
------------

[](#installation)

### Composer

[](#composer)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

The recommended way to install composer packages is:

```
composer require rogermaciel/cakephp-acl-manager

```

### Git submodule

[](#git-submodule)

```
git submodule add git@github.com:rogermaciel/cakephp-acl-manager.git plugins/AclManager
git submodule init
git submodule update

```

### Manual installation

[](#manual-installation)

Download the .zip or .tar.gz file, unzip and rename the plugin folder "cakephp3-aclmanager" to "AclManager" then copy the folder to your plugins folder.

[Download release](https://github.com/rogermaciel/cakephp-acl-manager/releases)

Getting started
---------------

[](#getting-started)

- Install the CakePHP ACL plugin by running *composer require cakephp/acl*. [Read Acl plugin documentation](https://github.com/cakephp/acl).
- Set AclManager configuration. ***AclManager.aros***. Must be specified before load plugin.
- Load the Acl and AclManager plugins in *app/config/bootstrap.php*.

```
# Example configuration for an schema based on Groups, Roles and Users
Configure::write('AclManager.aros', array('Groups', 'Roles', 'Users'));

Plugin::load('Acl', ['bootstrap' => true]);
Plugin::load('AclManager', ['bootstrap' => true, 'routes' => true]);
```

**Warning:** It is not recommended to use Plugin::loadAll();. if you use Plugin::loadAll(); make sure it will not load any plugin several times with Plugin::load('PluginName').

### Configuration parameters

[](#configuration-parameters)

Must be specified before load plugin.

- **AclManager.aros** Required. Sets the AROs to be used. The value of this parameter must be an array with the names of the AROs to be used.

```
# Example configuration for an schema based on Groups, Roles and Users
Configure::write('AclManager.aros', array('Groups', 'Roles', 'Users'));
```

- **AclManager.admin** Optional. Set 'admin' prefix. The value of this parameter must be boolean.

```
# Set prefix admin ( http://www.domain.com/admin/AclManager )
Configure::write('AclManager.admin', true);
```

- ***AclManager.hideDenied*** Hide plugins, controllers and actions denied in ACLs lists.

```
Configure::write('AclManager.hideDenied', true);
```

- ***AclManager.ignoreActions*** Ignore all plugins, controllers and actions you don't want to add to your ACLs. The value of this parameter must be an array.

```
    # Ecample:
    Configure::write('AclManager.ignoreActions', array(
        'actionName', // ignore action
        'Plugin.*', // Ignore the plugin
        'Plugin.Controller/*', // Ignore the plugin controller
        'Plugin.Controller/Action', // Ignore specific action from the plugin.
        'Error/*' // Ignore the controller
        'Error/Action' // Ignore specifc action from controller
    ));
```

Creating ACL tables
-------------------

[](#creating-acl-tables)

To create ACL related tables, run the following Migrations command.

```
bin/cake migrations migrate -p Acl

```

Example schema
--------------

[](#example-schema)

An example schema based on Groups, Roles and Users.

```
    CREATE TABLE `groups` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
        `created` datetime DEFAULT NULL,
        `modified` datetime DEFAULT NULL,
        PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

    CREATE TABLE `roles` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `group_id` int(11) DEFAULT NULL,
        `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
        `created` datetime DEFAULT NULL,
        `modified` datetime DEFAULT NULL,
        PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

    CREATE TABLE `users` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `group_id` int(11) NOT NULL,
        `role_id` int(11) NOT NULL,
        `username` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
        `password` char(255) COLLATE utf8_unicode_ci NOT NULL,
        `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
        `created` datetime DEFAULT NULL,
        `modified` datetime DEFAULT NULL,
        PRIMARY KEY (`id`),
        UNIQUE KEY `username` (`username`),
        UNIQUE KEY `email` (`email`)
    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
```

Auth
----

[](#auth)

Include and configure the *AuthComponent* and the *AclComponent* in the *AppController*.

```
    public $components = [
        'Acl' => [
            'className' => 'Acl.Acl'
        ]
    ];

    $this->loadComponent('Auth', [
        'authorize' => [
            'Acl.Actions' => ['actionPath' => 'controllers/']
        ],
        'loginAction' => [
            'plugin' => false,
            'controller' => 'Users',
            'action' => 'login'
        ],
        'loginRedirect' => [
            'plugin' => false,
            'controller' => 'Posts',
            'action' => 'index'
        ],
        'logoutRedirect' => [
            'plugin' => false,
            'controller' => 'Pages',
            'action' => 'display'
        ],
        'unauthorizedRedirect' => [
            'plugin' => false,
            'controller' => 'Users',
            'action' => 'login',
            'prefix' => false
        ],
        'authError' => 'You are not authorized to access that location.',
        'flash' => [
            'element' => 'error'
        ]
    ]);
```

Model Setup
-----------

[](#model-setup)

### Acting as a requester

[](#acting-as-a-requester)

Add $this-&gt;addBehavior('Acl.Acl', \['type' =&gt; 'requester'\]); to the initialize function in the files src/Model/Table/GroupsTable.php, src/Model/Table/RolesTable.php and src/Model/Table/UsersTable.php.

```
    public function initialize(array $config) {
        parent::initialize($config);

        $this->addBehavior('Acl.Acl', ['type' => 'requester']);
    }
```

### Implement parentNode function in Group entity

[](#implement-parentnode-function-in-group-entity)

Add the following implementation of parentNode to the file src/Model/Entity/Group.php.

```
    public function parentNode()
    {
        return null;
    }
```

### Implement parentNode function in Role entity

[](#implement-parentnode-function-in-role-entity)

Add the following implementation of parentNode to the file src/Model/Entity/Role.php.

```
    public function parentNode() {
        if (!$this->id) {
            return null;
        }
        if (isset($this->group_id)) {
            $groupId = $this->group_id;
        } else {
            $Users = TableRegistry::get('Users');
            $user = $Users->find('all', ['fields' => ['group_id']])->where(['id' => $this->id])->first();
            $groupId = $user->group_id;
        }
        if (!$groupId) {
            return null;
        }
        return ['Groups' => ['id' => $groupId]];
    }
```

### Implement parentNode function in User entity

[](#implement-parentnode-function-in-user-entity)

Add the following implementation of parentNode to the file src/Model/Entity/User.php.

```
    public function parentNode() {
        if (!$this->id) {
            return null;
        }
        if (isset($this->role_id)) {
            $roleId = $this->role_id;
        } else {
            $Users = TableRegistry::get('Users');
            $user = $Users->find('all', ['fields' => ['role_id']])->where(['id' => $this->id])->first();
            $roleId = $user->role_id;
        }
        if (!$roleId) {
            return null;
        }
        return ['Roles' => ['id' => $roleId]];
    }
```

Create a group, role, and user.
-------------------------------

[](#create-a-group-role-and-user)

Allow all. Add in AppController.php.

```
public function initialize() {
	parent::initialize();

	...
	$this->Auth->allow();
}
```

Now create a group, role, and user.

Access the plugin
-----------------

[](#access-the-plugin)

Now navigate to  ( or  If AclManager.admin is set to true ), just click *"Update ACOs and AROs and set default values"*, after update ACOs and AROs, remove *$this-&gt;Auth-&gt;allow()* from *AppController.php* and enjoy!

Known issues
------------

[](#known-issues)

- Not known.

Changelog
---------

[](#changelog)

### v1.3

[](#v13)

#### Added

[](#added)

- ***AclManager.hideDenied*** Hide plugins, controllers and actions denied in ACLs lists.

#### Changed

[](#changed)

- ***AclManager.ignoreActions*** Ignore all plugins, controllers and actions you don't want to add to your ACLs.

```
    Configure::write('AclManager.ignoreActions', array(
        'actionName', // ignore action
        'Plugin.*', // Ignore the plugin
        'Plugin.Controller/*', // Ignore the plugin controller
        'Plugin.Controller/Action', // Ignore specific action from the plugin.
        'Error/*' // Ignore the controller
        'Error/Action' // Ignore specifc action from controller
    ));
```

- Updated indexctp and permissioins.ctp: Show or hide ACLs that do not have permissions in the ACL list. Show flash messages below the actions panel.
- Fixed acoUpdate syncronization.

About CakePHP 3.x Acl Manager
-----------------------------

[](#about-cakephp-3x-acl-manager)

CakePHP 3.x - AclManager is a copy modified of plugin for manage CakePHP 3.x ACLs, [original plugin](https://github.com/ivanamat/cakephp3-aclmanager).

Author
------

[](#author)

Roger Maciel [on GitHub](https://github.com/rogermaciel)
[www.ivanamat.es](http://www.ivanamat.es/)

Licensed
--------

[](#licensed)

[MIT License](https://opensource.org/licenses/MIT)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2356d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/af4781af040edf52492bbc664dd4e3ff1f7073747230495e47d138c41272b65b?d=identicon)[rogermaciel](/maintainers/rogermaciel)

---

Top Contributors

[![rogermaciel](https://avatars.githubusercontent.com/u/420841?v=4)](https://github.com/rogermaciel "rogermaciel (1 commits)")

---

Tags

plugincakephpmanageraclcakephp3cake3

### Embed Badge

![Health badge](/badges/rogermaciel-cakephp-acl-manager/health.svg)

```
[![Health](https://phpackages.com/badges/rogermaciel-cakephp-acl-manager/health.svg)](https://phpackages.com/packages/rogermaciel-cakephp-acl-manager)
```

###  Alternatives

[ivanamat/cakephp3-aclmanager

AclManager plugin for CakePHP 3.x

2715.2k](/packages/ivanamat-cakephp3-aclmanager)[dereuromark/cakephp-tinyauth

A CakePHP plugin to handle user authentication and authorization the easy way.

129228.6k10](/packages/dereuromark-cakephp-tinyauth)[markstory/acl_extras

Additional tools for managing DB ACL in CakePHP applications.

155311.0k](/packages/markstory-acl-extras)[xety/cake3-cookieauth

A simple Cake3 plugin to authenticate users with Cookies.

1954.7k2](/packages/xety-cake3-cookieauth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
