Project:Menu attributes
Version:6.x-2.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:patch (to be ported)

Issue Summary

Is it possible to have permissions added to have access to menu attributes?

Comments

#1

Version:6.x-1.4» 6.x-2.0-beta1

#2

I am also looking for this feature.

#3

Version:6.x-2.0-beta1» 7.x-1.x-dev
Category:support request» feature request
Status:active» postponed (maintainer needs more info)

I'm wondering what the use case is. Pretty much we only alter existing UIs that already require the 'administer menus' permission either on the node form or the menu settings.

#4

Separation. For some users, it makes sense that they can add menu items and administrate menus (the links and structure) without seeing the extended attribute forms. For example, having an administrator, and simply having a content manager role. The content manager can still create menu items, or extraneous menu items (via Menu administration) but not necessarily need to see/edit menu attributes.

Maybe I am misunderstanding- but don't you need 'administer menus' to get to the menu links page to add links?

#5

Anyone with the 'administer menus' can do *anything* with menus and menu links, so I still don't see why we need to have a separate permission for menu attributes.

#6

I guess what I am saying is, if you don't have 'administer menus' permission, you can't add menu links from the admin. This is often necessary for navigation links that are not a node (usually ones that go off-site, or aliases of internal links for SEO). This is a great module for a themer, but confusing for end-user (a client) who sees the additional fields but won't use them.

Example:

UID 1 / developer / site administrators - have administer menus permission, can add/change menu attributes for theming or SEO
lower roles / content editors - have administer menus permission, but does not need to see/use anything about menu attributes

'administer menus' permission is important for both roles to create additional links from the menu administration.

#7

+1
Some things are only useful for administrators and confuse the end-user. I've been working on a project to simplify Drupal administration, and it's a lot of work where granularity of permissions is very important.

#8

Here is a patch I made to accomplish this. Might need to clear your cache, since hook_menu was changed.

It adds a 'administer menu attributes' permission, and with it, it will add attributes to forms that have menus attached.

AttachmentSizeStatusTest resultOperations
1077426.patch2.87 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1077426.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details | Re-test

#9

Noticed a typo in the hook_perm in previous patch. Resubmitting

AttachmentSizeStatusTest resultOperations
1077426.patch2.87 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1077426_0.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details | Re-test

#10

Status:postponed (maintainer needs more info)» needs review

I agree with #7 because I was also confronted with this issue, clients asking about some options that they'll never have to use. I had to alter some forms to hide those advanced options so I can surely see why this would be a good feature.

Patches attached for 6.x-1.x (see http://drupal.org/node/1241828#comment-4833998) and 7.x-2.x.

AttachmentSizeStatusTest resultOperations
1077426-menu_attributes_permission-D6.patch4.44 KBIgnored: Check issue status.NoneNone
1077426-menu_attributes_permission.patch4.07 KBIdleFAILED: [[SimpleTest]]: [MySQL] Failed to run tests: No valid tests specified. (Empty run-tests.sh --file argument.).View details | Re-test

#11

Status:needs review» needs work

This is adding access to the wrong places.

function _menu_attributes_form_alter() should be using the following: rather than having user_access() called in all of its callers:
$form['options']['attributes']['#access'] = user_access('administer menu attributes');

menu_attributes_form_menu_configure_alter() should just return rather than wrap its stuff in user_access() - less indentation makes the code easier to read and there's no reason for that function to continue if the user does not have the permission.

Also, we need to consider an upgrade path adding the permission to any role with the 'administer menu' permission since this would result in a loss of UI.

#12

Status:needs work» needs review

Nice! It's great to learn best practices like this :)

New patch for 7.x. If you are ok with it, I'll roll one for 6.x as well.

AttachmentSizeStatusTest resultOperations
1077426-menu_attributes_permission-12.patch2.25 KBIdlePASSED: [[SimpleTest]]: [MySQL] 108 pass(es).View details | Re-test

#13

Status:needs review» needs work

The last submitted patch, 1077426-menu_attributes_permission-12.patch, failed testing.

#14

Status:needs work» needs review

#12: 1077426-menu_attributes_permission-12.patch queued for re-testing.

#15

Status:needs review» patch (to be ported)

Commited #12 without the 'Implements hook_update_N()' doxygen to 7.x-1.x.

http://drupalcode.org/project/menu_attributes.git/commit/4dbf8c2

#16

Version:7.x-1.x-dev» 6.x-2.x-dev
nobody click here