6

How can I implement an ACL library? What is the best way for using ACL for user roles? In standard PHP, I'd write code like this:

if (userTypeId == 'Admin') {
  hello Admin
} else if (userTypeId == 'Member') {
   hello member
}

How would you do this using CodeIgniter?

SiKing
  • 10,003
  • 10
  • 39
  • 90
Muhammad Rashid
  • 563
  • 1
  • 6
  • 25
  • 1
    Please use Ion Auth library and `in_group` function for ACL (http://benedmunds.com/ion_auth/#in_group), it lightweight Auth library – Girish Jan 18 '14 at 15:37

3 Answers3

10

You can start working with Bonfire for ACL with codeigniter.

It is a ready to use Codeigniter framework with some additional functionalities. It contains User registration, authentication, and Role-Base Access Control....

Download link:

https://github.com/ci-bonfire/Bonfire/archive/master.zip

Documentation for working with user permissions and roles in bonfire:

http://cibonfire.com/docs/bonfire/roles_and_permissions

Balaji Kandasamy
  • 4,446
  • 10
  • 40
  • 58
4

You can find lot of links for tutorial while searching in google.

  1. http://www.tastybytes.net/blog/simple-acl-class-for-codeigniter
  2. https://code.google.com/p/ar-acl/
  3. https://github.com/brandesign/CodeIgniter-ACL // contains implementation

In SO also, how to use this simple acl library into codeigniter

Community
  • 1
  • 1
Kumar V
  • 8,810
  • 9
  • 39
  • 58
0

My preference on this is to pull in one of the Zend Framework modules. I've used ACL for probably 10+ years and it seems to be very rock solid:

https://framework.zend.com/manual/2.4/en/modules/zend.permissions.acl.intro.html

The newer version is Laminas ACL: https://docs.laminas.dev/laminas-permissions-acl/usage/

Yes you'll need to build a Library/Interface to the files but it is worth it.

Antony
  • 3,875
  • 30
  • 32