This plugins allows you to easily manage your permissions in CakePHP 2.x through the Acl module.
See: CakePHP: Simple ACL Controlled Application
It should look something like this:
var $components = array('Auth', 'Acl', 'Session');
function beforeFilter() {
//Configure AuthComponent
$this->Auth->authorize = array(
'Controller',
'Actions' => array('actionPath' => 'controllers')
);
$this->Auth->authenticate = array(
'Form' => array(
'fields' => array(
'username' => 'login',
'password' => 'password'
)
)
);
$this->Auth->loginAction = array(
'controller' => 'users',
'action' => 'login',
'admin' => false,
'plugin' => false
);
$this->Auth->logoutRedirect = array(
'controller' => 'users',
'action' => 'login',
'admin' => false,
'plugin' => false
);
$this->Auth->loginRedirect = array(
'controller' => 'products',
'action' => 'index',
'admin' => false,
'plugin' => false
);
}
function isAuthorized($user) {
// return false;
return $this->Auth->loggedIn();
}
Download the stable branch (https://github.com/FMCorz/AclManager/archive/stable.zip) and paste the content in your app/Plugin/
directory.
app/
folder of your project."fmcorz/acl-manager": "stable"
to your require
key in your composer.json
file. (More about this)php composer.phar install
to install the plugin.See AclManager/Config/bootstrap.php
AclManager.aros : write in there your requester models aliases (the order is important)
In app/Config/bootstrap.php
CakePlugin::load('AclManager', array('bootstrap' => true));
The plugin conflicts with $this->Auth->allow()
, do not use it. Just make sure that you are logged in.
/acl_manager/acl
Or uncomment return false
in AppController::isAuthorized()
Enjoy!
Licensed under the MIT License