26

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!

thekenobe
  • 469
  • 6
  • 10
Nobita
  • 23,519
  • 11
  • 58
  • 87
  • Answering to my own post, I think people who are looking for solutions to this kind of situations might find useful this: http://geekhut.org/2009/10/codeigniter-authentication-design-principles/ – Nobita Feb 12 '11 at 11:58
  • possible duplicate of [User authentication with CodeIgniter](http://stackoverflow.com/questions/457497/user-authentication-with-codeigniter) – Johan Sep 27 '13 at 22:48

4 Answers4

17

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.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
jondavidjohn
  • 61,812
  • 21
  • 118
  • 158
10

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.

Bo Persson
  • 90,663
  • 31
  • 146
  • 203
4

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

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

Kabir Hossain
  • 2,865
  • 1
  • 28
  • 34
4

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.

Dwayne Charrington
  • 6,524
  • 7
  • 41
  • 63
  • Sweet! I'm going to use yours Dwayne, it seems like it fits what I need. I will let you know if I find any bugs :) – Nobita Feb 13 '11 at 19:22