Skip to content
This repository has been archived by the owner on Apr 18, 2022. It is now read-only.

dmitrymomot/kohana-acl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#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

About

ACL module for Kohana >= 3.3 based on Wouterrr/ACL + Wouterrr/A2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages