views:

99

answers:

2

Hi,

I have built an app using codeigniter which has 3 different member groups

Admininstrators - Who login to a dashboard and have CRUD facilities to Add/Edit/Delete Events, shows and artists

Clients - Who Login from the front end and see all the items that the admin have added via the back end.

Media Partners - Who Login from the front-end and see certain parts of what the client can see but not all things.

I have integrated the Tank_Auth Library for the Clients section which all works fine. What I would like to achieve though is for the administrator to be able to login to a seperate admin area and the media partners to be able to login to a seperate area too.

What is the best way to approach this?

Do I need to create sepearate dashboard controllers for each userbase and duplicate the Tank_Auth controller 3 times and tweak this?

Ideally The Admin users also need to be able to add news users and login to all 3 seperate areas?

Has anybody achieved such a solution before, If so how did you go about it? perhaps tank auth isn't the correct approach?

Any input would be appreciated.

Thanks Dan

+1  A: 

I can't find the thread on the CI forums because I can't seem to login to their website right now, however do a search for 'zend_acl in codeigniter'. Alternatively there is this blog post about how to implement it, but it is slightly dated.

ACL stands for Access Control List, it will allow you to setup various permissions for different types of users. Zend has one of the best implementations of ACL in my opinion.

More information about ACL's can be found on zend's website.

evolve
Thanks Evolve, I will take a look now!
Dan C
+1  A: 

Hi,

I am using CI, but haven't used Tank_Auth, I have my auth class and in every function I have the following method called: $this->auth->accessMap(get_class($this),__FUNCTION__);

In auth class: public function accessMap($controller_name,$function_name) { if ($this->perms_array[$controller_name][$function_name]) return true; else $this->redir(); }

I have permissions array in config:

$config['user_perms']['className']['method1'] = array($config['user_types']['admin']);
$config['user_perms']['className']['method2'] = array($config['user_types']['admin'],$config['user_types']['user']);

Like this you can specify for each method which user has permission to use it.

I hope this will help.

KoKo
This sounds like a good way of achieving what I need KoKo, I know its cheating but are you able to post me your full files so I can get my head around it properly?
Dan C