userfrosting/UserFrosting

Navigation menu for new user groups

Closed this issue · 6 comments

It seems to me that if you create a new user group there is no function to add the group's navigation menu settings to the nav_group_matches table.

I noticed this from my fresh install today after adding a new default user group, searching online I couldn't find anyone else with this issue so maybe it is just me?

As far as I can tell the updatePageGroupLink function only checks permission for the page, checks if the page exists, gets the page's details, and updates it's status to private / public.

The only reference I can find to nav_group_matches is the function fetchMenu in db_functions, and it is only used to get the allowed menu not update it.

I will be trying to add this functionality to the addPage function unless someone else informs me of something I have done wrong.

You are correct, there is currently no frontend interface for adding new menu items, or associating them with user groups.

If you want to implement that feature, that would be awesome! Before you start coding though, we should try to plan this carefully around use scenarios and usability. A couple of things to keep in mind:

  1. Keep in mind that there is a difference between a group having permission to access a page, versus actually showing that page in the navigation menu. You might have a page that a group can access, but you don't necessarily want to be linked to directly from the menu (it might be linked from another page, for example). So, we should keep navigation management and access management decoupled.
  2. Remember that users can belong to more than one group. So, you don't necessarily need to add every single menu item for every single group.

I think the next step would be to implement individual pages for managing each group (something like group_details.php?group_id=3) We could get rid of the "Authorization" page, and instead move those options to the group management pages. On each group page then, you'd be able to see/modify the basic group info, permissions, pages, and menu items for the group.

What do you think?

Those are some great ideas. I was thinking of styling a page similar to the page-level authorization table. Something that would allow you to set if the page is on the menu or not, nothing too fancy. I think something with a drop down menu listing all the groups would be nice since some people might have a large amount of groups to administrate.

Well, I'm concerned that it might be tedious for admins if they have to go to one place to grant access to a page, and then another place to add that page to the navigation menu. But, I guess it depends on whether there are a large number of groups, a large number of pages, or both.

Certainly, the table scheme that we have right now won't scale well with a large number of groups. However, navigating to individual group management pages could also become tedious.

What if we had a table of groups with checkboxes next to them, and then a dropdown menu at the bottom where you can apply some properties (page access, nav menu items, etc) to the selected groups all at once? Then you could have the "select all/select none" button at the top.

So you're thinking something like the groups are all listed on a page, then you choose which action you are changing for all the groups via a drop down. (ie: set all groups' nav menus, then change the drop down to access levels and set that, etc.)

Correct. We could list those groups in a table, similar to the way that users are listed in their own table. On top of that, we could also have individual management pages for each group (just like how users each have their own page).

In 0.3.0, menus can now be configured to automatically show/hide nav items based on user permissions. This can be done using the checkAccess function. Example: https://github.com/alexweissman/UserFrosting/blob/dev-0.3.0/userfrosting/templates/themes/default/menus/sidebar.html#L23