I liked the tank auth authentication library by Ilya Konyukhov
I have added a simple role management feature to it.
You can download the latest version from https://bitbucket.org/mtsandeep/tank-auth-with-roles/overview
This is how it works. Roles can be added to the roles table. 2 roles added by default. First user to register will be given the “admin” role and all subsequent users will get the role set as “default”.
Usage is in the bitbucket repo.
Role name is saved to the session of logged in user.
To find the role name from a role id, use $this->tank_auth->get_role_name($role_id);
To get current logged in user’s role name, use $this->tank_auth->get_role();
To check if user is in specified role, use $this->tank_auth->is_role(‘role_name’); string passed return is boolean
for eg: $this->tank_auth->is_role(‘admin’); to check if current user is in admin role group
If you have any suggestions, i would like to improve this authentication library.