Tank Auth v1.0 (CI authentication library) |
[eluser]theshiftexchange[/eluser]
Part 3/3 The way it works is really simple. You create "roles" in your database. For example - Role "Purchasing" (RolesID 1), "HR" (RolesID 2), "Admin" (RolesID 3) You assign "roles" to users. For example - UserID 1 has RolesID 1, UserID 1 has RolesID 2 In your normal controllers you want to know if a user has the "Purchasing" role you would write: Code: if ($this->tank_auth->check_roles('Purchasing')) Please note the "check_roles" IS CASE SENSITIVE so "PURCHASING" would fail in the above example The great thing about this solution is you are not modifying your current database tables - you only add two more (so it can be 'bolted on' to a current solution). You can read some posts by Collin such as http://ellislab.com/forums/viewthread/121172/#600448 if you want to add even more functionality - but for me this did the job |
Welcome Guest, Not a member yet? Register Sign In |