Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter authentication + user privileges

I'm trying to build an authentication system in my application, but I'm having some problems in deciding which is the best way I could acomplish what I want in CodeIgniter.

The website allows companies to manage their buildings. A company can have many buildings, and many users (when I say users I mean employees from that company).

In this website I would like two have (basically) four general kind of users.

  • Super Admin: This would be able to add new admins and new companies to the database, and give privileges to the rest of the admins.
  • Admin: This would be able to do different stuff depending on the assigned privileges.
  • Company Super User: This user would be created directly when an admin creates a new company. This user would be able to create new users for that company, and since s/he would have total permissions, he would be able to do everything that the other users can do.
  • Company User: Depending on the privileges assigned by its super user, this user would be able to do and see different data (for example, a simple user would just be able to see information from one of the many company buildings).

So, even though I've seen many authentication libraries out there for CodeIgniter, it would be nice to hear any recommendations about how I could design this "authentication role based" system, and if you particularly recommend a library that could help to accomplish this.

Appreciate!

like image 335
Nobita Avatar asked Feb 12 '11 11:02

Nobita


4 Answers

There Are many libraries that already handle Authentication within Codeigniter, but the one I would recommend is Ion_Auth. It handles user permissions (groups) very well and I've actually done a detailed writeup outlining a good way to handle this situation with Ion_Auth.

like image 192
jondavidjohn Avatar answered Oct 14 '22 12:10

jondavidjohn


I suggest FlexiAuth library which is a re-modified version of ion Auth, and has lot of features already built in, simply out of the box.

like image 45
CodeIgniter Expert Avatar answered Oct 14 '22 12:10

CodeIgniter Expert


I've been developing a role based authentication system for Codeigniter called WolfAuth, here's the repository. It's still early days, but it sort of works. You can add roles, etc and then restrict functions and classes to particular user roles and usernames.

like image 4
Dwayne Charrington Avatar answered Oct 14 '22 12:10

Dwayne Charrington


Use CI_aauth. I like this, this is very good from others auth.

https://github.com/kabircse/CodeIgniter-Aauth

like image 4
Kabir Hossain Avatar answered Oct 14 '22 11:10

Kabir Hossain