Session Codeigniter - Automatic Check data
===

What would be the best way to work with sessions CodeIgniter to do the following ?

I have users with a role and a company that are stored in a database.

I want identify user role and company without do :

    if($roles == 'Editor'): 
    
    // do something
    
    endif;

In each controller or method. 

**Example :**

If users is logged a function in header checks that and if not it redirects to the homepage.