• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.