[eluser]Unknown[/eluser]
Im trying to get a base done for a permission based admin system
i have to add alot of pages foreach type of admin,
so naturally I would want to split that code
all i would want to do is if the session isset get the permission (string)
from that current logged in user and use it as a way to access another
controller (class/method), therefor splitting all those different admin pages into their own
//part of the code
Code:
//in main controler Admin
function __construct() {
parent::__construct();
if ($this->session->userdata('admin_logged_in')) {
$admin_type = $this->session->userdata('admin_type');
//send it to ohter controller here
//something of the like:
include APPPATH.'/controllers/site_admin/site_admin_'.$admin_type.'.php';
// OR/AND:
$admin_type->$method
}
}
public function login()
public function logout()
etc
//the 3 different admin types (in their classes here)
class workers extends CI_Controller { /* their pages/functions/methods here */ }
class coordinators extends CI_Controller { /* their pages/functions/methods here */ }
class administration extends CI_Controller { /* their pages/functions/methods here */ }
so i could call
site.we/admin/somefunc
and either be directed to
workers/somefunc
or
coordinators/somefunc
depending who logged in with what permission(s)
i would have wanted to use the router
but i cant access the session there
..so, is there anyway to send the same request to a different controller, from a controller ???
also, im not worried about duplication in cases, like having the same method/page in different controllers
like /admin/workers/somefunc and /admin/coordinators/somefunc
aslong as i can keep the administrators separate in an easy way
thanx in advanced
great forum =D