Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (4) | Download .zip | Reputation | Support forum (1) | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2022-10-21 (28 days ago) | Not enough user ratings | Total: 342 This week: 4 | All time: 7,030 This week: 221 |
Version | License | PHP version | Categories | |||
ci-acl 1.0.1 | MIT/X Consortium ... | 5 | PHP 5, User Management, Libraries |
Description | Author | |||||||||||||
This class can manage the access of CodeIgniter users using ACL. |
|
Implements an Access Control List for your applications written with Codeigniter.
You should use it in order to help you control which path the user can (or cannot) access.
Download this project, and copy its content into your Codeigniter app, under `
application`
folder.
For example:
/ (project root directory)
/application
--/config
--/libraries
-- ...
After "instal" it on your app, then you'll need to setup all acl definitions.
All those definitions should be placed in `
./applicaton/config/acl.php`
, i.e:
$acl = array(
/WELCOME/
'welcome/index' => array(
'public'
),
'welcome/private_users' => array(
'user' => TRUE,
'admin' => FALSE
),
'welcome/private_admins' => array(
'user' => FALSE,
'admin' => TRUE
)
);
Finally, in order to test if given path is valid or not, do as following:
$ci =& get_instance();
$ci->load->library('acl');
// check if given path isn't public
if (! $ci->acl->is_public('path/to/test'))
{
if (! $ci->acl->is_allowed('path/to/test', 'role-to-test'))
{
// do your stuff here ...
// i.e: set the error message and redirect to some page.
}
}
That's all.
There some methods that can be used on runtime:
Return TRUE when given path is set as 'public', otherwise, return FALSE.
Return TRUE when given role is set as 'true' for given path, otherwise, return FALSE.
This method is used to add new ACL rules that are not present on `
config/acl`
on runtime.
It's very useful when you're storing your ACL rules on database.
I.e:
$ci->acl->set( 'a/new/path/to/check', array( 'user' => FALSE, 'admin' => TRUE ) ); // or
$ci->acl->set( 'a/new/path/to/check', array( 'public' ) );
Report bugs, make suggestions and get involved on contributions.
Feel free to get in touch. ;)
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Comments (1) | |||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.