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

les lim’s picture

Improved the looping since the last patch.

agentrickard’s picture

Is it possible to do this without introducing the module dependency?

bforchhammer’s picture

I 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.

les lim’s picture

@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.

les lim’s picture

@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.

bforchhammer’s picture

Status: Needs work » Postponed

Just 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.

bforchhammer’s picture

Issue summary: View changes

Clarify functionality desired

anrikun’s picture

anrikun’s picture

Status: Postponed » Needs work

hook_menu_admin_per_menu_alter() was renamed to hook_menu_admin_per_menu_perm_menus_alter() for clarity.
Patch should be updated accordingly.

Also note that an $account parameter is now required.

Algeron’s picture

Status: Needs work » Needs review
StatusFileSize
new1.3 KB

Thx anrikun!
Updated patch in attachment.