Search code examples
phpcodeigniterion-auth

How to create sub groups in ion auth codeigniter?


I know we can create groups in ion auth. But I need sub group inside members and staff groups.The following user roles are required for my project.

  1. Admin
  2. Members
    • plan A members
    • plan B members
    • plan C members
  3. Staff
    • technical staff
    • management staff
    • general staff

Based on plan selected by member, the 'views' and functionalities will change.

I was thinking of adding a new column to users table to specify the plan used. Another option is to create 3 plan groups without parent member group. Is there any other way to add sub groups using ion auth?


Solution

  • @Arunu - your idea to make them each groups, not subgroups, is the best way to go.

    There is no real reason to have a hierarchy of permissions (I think you may be mixing authentication with ACL a bit, a very easy thing to do).

    Ion_auth is set up so that a user can have multiple groups - so, for example, all your users could have a Members record, and then a separate record for each sub group.

    Each controller entry point simply says what groups are allowed in or not - it treats them all the same.

    also, you can dynamically display data based on what groups the user belongs to