Menu Admin per Menu
Provides granular per-menu administration permissions, allowing roles to manage specific menus without granting full menu administration access.
menu_admin_per_menu
Install
composer require 'drupal/menu_admin_per_menu:8.x-1.7'
composer require 'drupal/menu_admin_per_menu:8.x-1.5'
composer require 'drupal/menu_admin_per_menu:8.x-1.4'
Overview
By default, Drupal allows only users with the global "Administer menus and menu items" permission to add, modify or delete menu items. This creates an all-or-nothing scenario where users either have full control over all menus or no control at all.
Menu Admin per Menu solves this limitation by dynamically creating individual permissions for each menu in your Drupal site. For example, you can grant a role permission to manage the Main menu without giving them access to the Navigation menu or Management menu.
The module seamlessly integrates with Drupal's existing menu administration interface, automatically filtering the menu overview page to show only menus the user has permission to administer. It also properly filters the parent menu selection on node edit forms, ensuring users can only place content in menus they have access to.
This is a Drupal 7 module that extends Drupal's core menu system with fine-grained access control capabilities.
Features
- Creates dynamic permissions for each menu (e.g., 'Administer Main menu menu items', 'Administer Navigation menu items')
- Filters the menu administration overview page to display only menus the user has permission to manage
- Controls access to individual menu link operations including add, edit, reset, and delete
- Automatically filters parent menu options on node edit forms based on user's menu permissions
- Provides an alter hook allowing other modules to programmatically modify per-menu permission assignments
- Caches permission lookups per user account for improved performance
- Maintains full compatibility with users who have the global 'Administer menus and menu items' permission
Use Cases
Content Editor with Limited Menu Access
A website has content editors who should be able to add pages to the Main menu but should not have access to modify the Administration menu or other system menus. By enabling this module and granting the 'Administer Main menu menu items' permission to the Content Editor role, editors can manage Main menu items while being restricted from other menus.
Department-Specific Menu Management
A multi-department organization website has separate menus for each department (HR menu, Sales menu, Engineering menu). Each department manager needs to manage only their department's menu. This module allows creating a role for each department with permission only to their specific menu.
Restricting Footer Menu Access
The footer menu contains important links that should only be modified by senior administrators. Regular administrators can manage all other menus but the footer menu permission is only granted to a special role, ensuring critical links are protected.
Programmatic Menu Permission Control
A custom module needs to dynamically control which menus users can access based on complex business logic (e.g., based on user profile fields or group membership). Using hook_menu_admin_per_menu_perm_menus_alter(), the custom module can add or remove menu access programmatically.
Tips
- Users with the global 'Administer menus and menu items' permission automatically have access to all menus, bypassing per-menu permissions
- The module caches permission lookups per user account for performance - clear caches after permission changes
- Use the hook_menu_admin_per_menu_perm_menus_alter() hook for complex permission scenarios that cannot be handled through standard role permissions
- When a menu item already exists in a menu the user cannot access, the menu fieldset will be hidden on that node's edit form
- The module only controls access to menu administration - it does not affect how menus are displayed to end users on the frontend
Technical Details
Admin Pages 6
/admin/structure/menu
Overview page listing all menus. When accessed by users without the global 'administer menu' permission, this page is filtered to show only menus for which the user has per-menu admin permissions. Each permitted menu displays 'list links' and 'add link' operation links.
/admin/structure/menu/manage/%menu
View and manage all links within a specific menu. Access is controlled per-menu - users need either the global 'administer menu' permission or the specific 'Administer [menu name] menu items' permission.
/admin/structure/menu/manage/%menu/add
Add a new link to a specific menu. The parent menu dropdown is filtered to show only menus and items the user has permission to manage.
/admin/structure/menu/item/%menu_link/edit
Edit an existing menu link. Access is controlled based on which menu the link belongs to. The parent menu dropdown is filtered based on user permissions.
/admin/structure/menu/item/%menu_link/delete
Delete a menu link. Access requires permission for the menu containing the link.
/admin/structure/menu/item/%menu_link/reset
Reset a menu link to its default settings. Access requires permission for the menu containing the link.
Permissions 1
Hooks 1
hook_menu_admin_per_menu_perm_menus_alter
Allows modules to alter the array of menus for which a user has per-menu administration permissions. This hook is invoked after the module has determined which menus the user can access based on their permissions.
Troubleshooting 4
The module does not automatically grant any permissions. Navigate to admin/people/permissions and assign the appropriate 'Administer [menu name] menu items' permissions to the relevant roles.
Ensure the user's role has the 'Administer [menu name] menu items' permission for the specific menu where they want to place content. The permission affects both the menu administration pages and the menu selection on node edit forms.
Clear Drupal's cache as the permission lookups are cached per user. Use drush cc all or navigate to admin/config/development/performance and clear caches.
Verify the user does not have the global 'Administer menus and menu items' permission, which overrides per-menu permissions and grants access to all menus.
Security Notes 4
- The module includes proper permission caching per user account to prevent permission leakage between users
- All access checks properly fall back to the global 'administer menu' permission for users who have it
- The alter hook allows programmatic control but should be implemented carefully to avoid accidentally granting unintended access
- This module has official Drupal security advisory coverage, meaning security issues are reviewed and addressed by the Drupal Security Team