CodeIgniter Forums
Check for roles inside model? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10)
+--- Thread: Check for roles inside model? (/showthread.php?tid=66847)



Check for roles inside model? - oterox - 12-10-2016

Hi,
i'm using Community Auth forĀ Authentication. I want to restrict the database result based on the role
Right now in the model the funcions are like this:

get_finantial_report( some parameters, user_level, user_id)
and i get the user_level and user_id in the controller:
$this->auth_role
$this->auth_user_id


Would be better to remove those parameters (user_level, user_id) form the function and get them inside the funcion instead off passing them from controller to model?