Posts

Showing posts with the label user roles

How To Confine Controllers Functions Based On User Roles Inward Codeigniter?

To bound logged inwards users from an entire controller is fairly elementary inwards Codeigniter. business office __construct(){ parent::__construct(); // to protect the controller to endure accessed alone past times registered users if(!$this->session->userdata('logged_in')){ redirect('login', 'refresh'); } } This plant great. The user is non allowed access to functions or methods inside the controller unless they are authenticated or registered users. If you lot desire to bound controllers functions/methods based on user roles , you lot tin dismiss create the next way: business office __construct(){ parent::__construct(); // to protect the controller to endure accessed alone past times registered users if(!$this->session->userdata('logged_in')){ redirect('login', 'refresh'); } //list of protected methods to access (for inst...