user permissions as per page basis |
i have 3 type of users namely assistant,officer,General manager.How i set permissions to each roles to them(certain pages need permission to only managers) thankz in advance?/
1) Create a restrict() method in your auth system and then check it in the controllers constructor.
Your Auth System: PHP Code: // ------------------------------------------------------------------- Change and modify the above to suit your needs. 2) In your controllers construct add the below. Controller constructor: PHP Code: public function __construct() Hope that helps. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
error line
Code: if ($userLevel > $level OR $single == true && $userLevel !== $level) (05-09-2018, 11:34 PM)renoldtrueman Wrote: i have 3 type of users namely assistant,officer,General manager.How i set permissions to each roles to them(certain pages need permission to only managers) thankz in advance?/Before i answer, do you use your own authentication or do you use an authentication library like Community Auth, IonAuth, etc?
Sorry I forgot to add the config array for Groups.
You will need to add this to a config file and load it to use the Groups. PHP Code: /** Hope that helps. The $level is stored in the users table that matches the number of the group array. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |