houseoftech/cakephp-acl-manager
最新稳定版本:1.3.2
Composer 安装命令:
composer require houseoftech/cakephp-acl-manager
包简介
AclManager for CakePHP 2.x
README 文档
README
This plugins allows you to easily manage your permissions in CakePHP 2.x through the Acl module.
Features
- Managing permissions for each node
- Updating Database with missing AROs (Users, Roles, ...)
- Updating Database with missing ACOs (Controller actions)
- Revoking all permissions
Requirements
- CakePHP 2.x
How to install
1. Set up your Acl environment
- Install SQL tables through Cake Console
- parentNode() method on your requester models
See: CakePHP: Simple ACL Controlled Application
2. Configure Auth in your AppController
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(); }
3. Download AclManager
Manually
Download the stable branch (https://github.com/houseoftech/cakephp-acl-manager/archive/stable.zip) and paste the content in your app/Plugin/ directory.
With Composer
- Install composer in the
app/folder of your project. - Add
"houseoftech/cakephp-acl-manager": "stable"to yourrequirekey in yourcomposer.jsonfile. (More about this) - Run
php composer.phar installto install the plugin.
4. Configure the plugin
See AclManager/Config/bootstrap.php
AclManager.aros : write in there your requester models aliases (the order is important)
5. Enable the plugin
In app/Config/bootstrap.php
CakePlugin::load('AclManager', array('bootstrap' => true));
6. Login with an existing user
The plugin conflicts with $this->Auth->allow(), do not use it. Just make sure that you are logged in.
7. Access the plugin at /acl_manager/acl
- Update your AROs and ACOs
- Set up your permissions (do not forget to enable your own public actions!)
8. Disable the authorizer Controller
Or uncomment return false in AppController::isAuthorized()
9. You're done!
Enjoy!
Licence
Licensed under the MIT License
统计信息
- 总下载量: 111
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-26