Welcome Guest, Not a member yet? Register   Sign In
Stuck with permissions based menu ideas after Ion Auth update

I'm really hoping someone can give me a fresh pair of eyes and possible solution to this as I've got a little stuck.

When I first developed my app, I used Ion Auth 1.4 which only allowed 1 group per user. I have recently updated Ion Auth to 2.2.4 and whilst I can see the new features like multiple groups in action already within my app, I can't figure out how to re-model the permissions based menu system that I built around 1.4.

Essentially, the menu system I have, is built around a menu table consisting of the following fields:


Now, as 1.4 allowed only 1 group per user, it was relatively straight forward. I would assign a menu item to a group allowed to access it such as 'Admins' and any group_id below this was not allowed to access it. The app would simply pull all menu items with the group_id assigned to 'Admin' or below. So 'Admin' = group_id #1 and 'Users' = group_id #3 meaning that any menu item assigned to group #3 would be accessible by any group equalling it or above.

Now with the ability to have multiple groups per user, I'm not quite sure how to store the group_id's in the menu table that will allow me to query it.

I had thought of another table linking menu items to groups but if a menu was available to multiple groups it might become difficult to manage. I had also thought of storing the groups that had access to the menu in a serialised or JSON string but I'm not sure how you would go querying the menu table to get the right menu items.

If anyone can suggest a way of doing this that would be great. I'm just struggling a bit due to a little inexperience of this.

Thanks in advance,

I eventually opted for adding another table to hold the relationship between menu items and groups. It should give me a little more control over the menu itself although maintaining it will be a little more complex.

I realise it wasn't a simple question that could be answered in 5 minutes so thanks to all that looked and probably thought...WTF? Wink


Theme © iAndrew 2016 - Forum software by © MyBB