I needed to designate a "domain admin" role that could administer only the Domain Menu Block menus associated with a user's domains. Drupal core doesn't really allow for this; there's an all-or-nothing "Administer menus and menu links" permission, but no per-menu, granular menu permissions.
This isn't a hard limitation to overcome; the Menu Admin per Menu module allows for per-menu admin permissions using custom access callbacks and a few simple form alters. Attached is a patch that integrates Domain Menu Block with that module.
This is dependent on #1638424: Allow modules to alter the list of permitted menus in Menu Admin per Menu's issue queue, so I'm setting this as "Needs work" for now.
Comments
Comment #1
les limImproved the looping since the last patch.
Comment #2
agentrickardIs it possible to do this without introducing the module dependency?
Comment #3
bforchhammer commentedI like the idea!
If I read the patch correctly, this will remove access for all users even if the Menu Admin per Menu module is not installed. I don't think that should be the case.
Comment #4
les lim@agentrickard: This could probably be implemented without the other module, perhaps by creating new admin settings pages under 'admin/structure/domain/...' rather than overriding menu.module's menu callbacks.
Besides just overriding menu access callbacks, though, menu_admin_per_menu.module also alters the options in the "Parent item" dropdown on both the node form and the menu link edit form. That would also need to be re-implemented.
Comment #5
les lim@bforchhammer: Not having Menu Admin per Menu module shouldn't be a problem. The patch doesn't have any code that acts on the menu system directly. Besides, if the other module isn't enabled, the
hook_menu_admin_per_menu_alter()implementation never executes.Comment #6
bforchhammer commentedJust tested this patch and it works nicely... Unless something changes, I'd be happy to commit as soon as #1638424: Allow modules to alter the list of permitted menus is resolved.
Comment #6.0
bforchhammer commentedClarify functionality desired
Comment #7
anrikun commentedPatch at #1638424: Allow modules to alter the list of permitted menus was just committed.
Comment #8
anrikun commentedhook_menu_admin_per_menu_alter()was renamed tohook_menu_admin_per_menu_perm_menus_alter()for clarity.Patch should be updated accordingly.
Also note that an
$accountparameter is now required.Comment #9
Algeron commentedThx anrikun!
Updated patch in attachment.