Kohana ACL
ACL module for Kohana >= 3.3 based on Wouterrr/ACL + Wouterrr/A2, (*1)
Dependencies
Installation
First off, download and enable the module in your bootstrap., (*2)
Add the necessary tables and fields in the database using migrations:, (*3)
$ ./minion db:migrate --module=kohana-acl
Settings
.........., (*4)
Usage
Simple usage without file config or database
Add resource, (*5)
ACL::instance()->add_resource('news');
Add roles, (*6)
ACL::instance()->add_role('guest');
ACL::instance()->add_role('member');
ACL::instance()->add_role('editor');
ACL::instance()->add_role('admin');
Allow "guest" to "view" the news, (*7)
ACL::instance()->allow('guest', 'news', 'view');
Allow "member" to "comment" on "news", (*8)
ACL::instance()->allow('member', 'news', 'comment');
Allow "editor" to do anything, except "delete" news, (*9)
ACL::instance()->allow('editor', 'news');
ACL::instance()->deny('editor', 'news', 'delete');
Allow "admin" to do anything, (*10)
ACL::instance()->allow('admin');
Check permissions for current user, (*11)
ACL::check('news', 'edit'); // return boolean value
Check permissions for any role, (*12)
ACL::instance()->is_allowed('guest', 'news', 'comment');
ACL::instance()->is_allowed('editor', 'news', 'add');
ACL::instance()->is_allowed('admin', 'news', 'delete');
Drivers
Use Auth as driver
See demo application
or use default driver which is wrapper for Auth., (*13)
Creating new driver
Class must implement interface ACL_Auth_Interface.
For example see default driver, (*14)