Welcome Guest, Not a member yet? Register   Sign In
Session Validation before come to controller
#5

A better method would be called restrict()

Which would check the user and then do the restriction on them.

PHP Code:
    /**
     * __construct ()
     * -------------------------------------------------------------------
     *
     * Class    Constructor
     *
     * NOTE: Not needed if not setting values or extending a Class.
     */
    
public function __construct()
    {
        
parent::__construct();

        
// restrict this controller to admins only
        
$this->auth->restrict('Admin');

        
// Load the user model - gets a lists of users
        
$this->load->model($this->models."UserModel"'users');

        
log_message('debug'"Users Controller Class Initialized");
    } 

The restrict method would check the users groups to make sure that it was the Admin.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: Session Validation before come to controller - by InsiteFX - 04-13-2018, 04:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB