1

I am looking to use Ion Auth as an authentication library in one of my newer projects but I cant seem to understand how to handle permissions to perform certain actions.

For example, I have deals and items and a group "A" which can update both deals and items, and a group "B" which can only update items. How do I code this to make it work?

doing something like this:

//updating deals and items
if($user->in_group('A') || $user->in_group('B')){
    // ok so hes got permission to do it.
}

seems like a very bad approach since this is something that should be dynamic.

ekad
  • 14,436
  • 26
  • 44
  • 46
Ahmed-Anas
  • 5,471
  • 9
  • 50
  • 72

1 Answers1

2

What you are looking for is what is called an ACL (Access Control List), which is not the same as an authentication library & is not included in ion_auth by design

You can google around for a good library you like

jmadsen
  • 3,635
  • 2
  • 33
  • 49
  • Thanks for the answer... I diddnt know that. Instead of using another ACL, I simply extended ion_auth library (with a bunch of hacks since CI unfortunately dosent support extending libraries). Since ion_auth already had 'groups', all I had to do was add a permissions table and do a many-to-many join with groups table (and obviously add a few functions to the library) – Ahmed-Anas Jul 29 '13 at 17:17
  • CI is just php, and so supports extending classes just fine - that is the recommended way of adding on to Ion Auth or anything else. Glad you got it to work out – jmadsen Jul 29 '13 at 21:21