Codeigniter Simple ACL

MadhukarAnand.com

A simple Role Based Access Control List that dosen’t require a database.

Users can have multiple roles, and roles have access permissions.

I’ve based this on the Drupal ACL which I very much like.

A configuration file called acl.php which needs to be stored in applications/config folder

A library file called acl.php which needs to stored in the applications/libraries folder

Inside the config file is the config array which has two arrays

$config[ ‘permission’ ] = array();

and

$config[ ‘roles’ ] = array();

To setup roles simply add role names, any names you like but you must have ‘admin’ as your main website owner/administrator

ie

$config[ ‘roles’ ] = array( ‘user’, ‘blogger’, ‘editor’, ‘umpire’, ‘admin’ );

now set up the permission (which I tend to do on a controller basis);

$config[ 'permission' ] = array(     'users' => array(         'add' => array( 'admin' ),         'edit own'…

View original post 234 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s