Download the PHP package dmitrymomot/kohana-acl without Composer
On this page you can find all versions of the php package dmitrymomot/kohana-acl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dmitrymomot/kohana-acl
More information about dmitrymomot/kohana-acl
Files in dmitrymomot/kohana-acl
Package kohana-acl
Short Description Kohana v3 ACL
License MIT
Homepage https://github.com/dimkof/kohana-acl
Informations about the package kohana-acl
Kohana ACL
ACL module for Kohana >= 3.3 based on Wouterrr/ACL + Wouterrr/A2
Dependencies
Installation
First off, download and enable the module in your bootstrap.
Add the necessary tables and fields in the database using migrations:
$ ./minion db:migrate --module=kohana-acl
Settings
..........
Usage
Simple usage without file config or database
Add resource
ACL::instance()->add_resource('news');
Add roles
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
ACL::instance()->allow('guest', 'news', 'view');
Allow "member" to "comment" on "news"
ACL::instance()->allow('member', 'news', 'comment');
Allow "editor" to do anything, except "delete" news
ACL::instance()->allow('editor', 'news'); ACL::instance()->deny('editor', 'news', 'delete');
Allow "admin" to do anything
ACL::instance()->allow('admin');
Check permissions for current user
ACL::check('news', 'edit'); // return boolean value
Check permissions for any role
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.
Creating new driver
Class must implement interface ACL_Auth_Interface. For example see default driver