EllisLab text mark
Advanced Search
1 of 2
1
   
My “official” ACL plugin for CI - Now with [some] documentation
Posted: 01 March 2010 05:14 PM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Joined: 2009-11-12
11 posts
bkirkman - 27 February 2010 01:41 AM

I’ve been familiarizing myself with the plug-in as I incorporate it into a project.  Would it be possible/beneficial to pass an array of role_ids to user_has_role() and group_has_role() instead of just a single role_id?  I’m guessing many times in a project, access would be given based on a handful of roles.  (Of course we could just use OR statements.)  I’m also guessing a hierarchy or ranking of roles is often used for ACLs.  There also might be other class methods where passing an array to it might be beneficial.  Just a couple of thoughts.

That sounds like a great idea, however.

The thinking was database optimization. I could implement this, but I would not recommend it unless using it on an ACL user/group/role objects: i.e.:

$user $acl->get_user('10',TRUE);
$user->has_role('3'); 

The reason is: when you return a user object one of the options is to auto hydrate (or not). The default [when returning ACL users, groups, and roles] is NOT to hydrate.

When you auto hydrate, the ACL user/group/role objects pre-polulate [load] all the relating info into variables. This way, multiple tests are only comparing variables rather than making repetitive database calls.

Ideally, when a user is logged in, you would instantly create a ACL user object that represents that user.

In the case of the ACL class, you would not (even from a logical programmatic standpoint) have auto hydration going on in the parent ACL object level. So bottom line is: passing arrays for checking can be implemented at both the core ACL level AND ACL user/group/role levels - but only advisable to use this feature at the user/group/role levels. This way, auto hydration makes it easy and much more practical from a performance standpoint.

I will work on integrating this into the classes sometime this next couple weeks unless someone wants to pitch in wink

 
Posted: 01 March 2010 08:43 PM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Joined: 2009-11-23
9 posts

Aha, thanks.  That makes sense.  Have you been successful at storing the user object as a session object?  I haven’t tried yet.  There seems to be quite the shake-up regarding session objects here.
http://ellislab.com/forums/viewthread/95690/

 
Posted: 24 May 2010 09:50 PM   [ Ignore ]   [ # 13 ]   [ Rating: 0 ]
Joined: 2008-11-27
10 posts

Thanks for your plugin. I has been tried and it’s look good.
But it have small bug. When you try :

$this->acl->add_role_to_user(21); 

it generate error. In acl.php line 654:

$this->db->insert($this->db_table['user_roles'],$data); 

it should be:

$this->db->insert($this->_table['user_roles'],$data); 
 
Posted: 22 July 2011 03:39 PM   [ Ignore ]   [ # 14 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-20
63 posts

Is this plug-in still being developed/supported?  I find it interesting and would like to work at converting it to CI 2.x and PHP 5.3.x.

 
Posted: 12 March 2012 09:48 AM   [ Ignore ]   [ # 15 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-20
63 posts

Anybody???

 
Posted: 04 August 2012 02:06 AM   [ Ignore ]   [ # 16 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-25
6 posts

I’ve created a simple Role Base ACL and User Login system that does not require a database setup.

You can download it from my personal blog

http://www.kevinphillips.co.nz

or from github

https://github.com/dollardad/CI-ACL

I look forward to your feed back

 Signature 

Working with Drupal is like building a boat but starting with a car!

 
Posted: 01 October 2012 03:39 AM   [ Ignore ]   [ # 17 ]   [ Rating: 0 ]
Joined: 2012-09-19
1 posts

sorry guys, i can’t to download the file.

Pls advise give me how to?

 
Posted: 02 April 2013 11:53 PM   [ Ignore ]   [ # 18 ]   [ Rating: 0 ]
Joined: 2013-03-27
1 posts

Helo…

I’m very interested with this ACL, unfortunately. The link is dead. Can you have some new link? Many thanks…

 
1 of 2
1