Codeigniter: Controlling log in privileges with inheritance Codeigniter: Controlling log in privileges with inheritance codeigniter codeigniter

Codeigniter: Controlling log in privileges with inheritance


Ended up not changing the parent constructor or using more inheritance at all:

Added the following to My_Controller:

public function allowedToView($userAccountType, $requiredAccountTypes){    //If user not in allowed userGroup    if(!(in_array($userAccountType,$requiredAccountTypes))){        redirect('/sessions/not_allowed/','refresh');    }}

Changed child constructor to:

public function __construct() {    parent::__construct();    $accountType = $this->session->userdata('accountType');    $allowedTypes = array(declaredConstant1,declaredConstant2,...);    $this->allowedToView($accountType,$allowedTypes);}

Thanks, Joseph for the insight leading me away from my craziness!