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

Files: 
CommentFileSizeAuthor
#27 1077426_27-make_permissions_work.patch1.63 KBcweagans
PASSED: [[SimpleTest]]: [MySQL] 108 pass(es).
[ View ]
#25 1077426_25-make_permissions_work.patch1.2 KBcweagans
FAILED: [[SimpleTest]]: [MySQL] 71 pass(es), 69 fail(s), and 0 exception(s).
[ View ]
#21 1077426_21-make_permissions_work.patch1.24 KBcweagans
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in sites/default/modules/menu_attributes/menu_attributes.module.
[ View ]
#19 make_permissions_work.patch1.24 KBcweagans
FAILED: [[SimpleTest]]: [MySQL] 71 pass(es), 69 fail(s), and 0 exception(s).
[ View ]
#12 1077426-menu_attributes_permission-12.patch2.25 KBamateescu
PASSED: [[SimpleTest]]: [MySQL] 108 pass(es).
[ View ]
#10 1077426-menu_attributes_permission-D6.patch4.44 KBamateescu
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1077426-menu_attributes_permission-D6.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#10 1077426-menu_attributes_permission.patch4.07 KBamateescu
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: No valid tests specified. (Empty run-tests.sh --file argument.).
[ View ]
#9 1077426.patch2.87 KBkevinquillen
FAILED: [[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 ]
#8 1077426.patch2.87 KBkevinquillen
FAILED: [[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 ]

Comments

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

I am also looking for this feature.

Version:6.x-2.0-beta1» 7.x-1.x-dev
Category:support» feature
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.

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?

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.

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.

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

StatusFileSize
new2.87 KB
FAILED: [[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 ]

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.

StatusFileSize
new2.87 KB
FAILED: [[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 ]

Noticed a typo in the hook_perm in previous patch. Resubmitting

Status:Postponed (maintainer needs more info)» Needs review
StatusFileSize
new4.07 KB
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: No valid tests specified. (Empty run-tests.sh --file argument.).
[ View ]
new4.44 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1077426-menu_attributes_permission-D6.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

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.

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.

Status:Needs work» Needs review
StatusFileSize
new2.25 KB
PASSED: [[SimpleTest]]: [MySQL] 108 pass(es).
[ View ]

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.

Status:Needs review» Needs work

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

Status:Needs work» Needs review

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

Version:7.x-1.x-dev» 6.x-2.x-dev

For some reason I haven't been getting notified of updates on this thread.

I am a little confused by the last few posts- is this feature now in the newest version of Menu Attributes? Or still just the dev?

Nevermind- I see now. I misread one post and saw the status change in the other.

Thanks for the progress here all.

Version:6.x-2.x-dev» 7.x-1.x-dev
Status:Patch (to be ported)» Needs review
StatusFileSize
new1.24 KB
FAILED: [[SimpleTest]]: [MySQL] 71 pass(es), 69 fail(s), and 0 exception(s).
[ View ]

Not quite. The related #access property is being set like three times in the alter function, but it all gets overridden at the end when the function checks for any visible children.

The attached patch fixes it in 7.x.

Status:Needs review» Needs work

The last submitted patch, make_permissions_work.patch, failed testing.

StatusFileSize
new1.24 KB
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in sites/default/modules/menu_attributes/menu_attributes.module.
[ View ]

Ahem. With correct PHP syntax this time.

Status:Needs work» Needs review

Is it me or this is the same patch? :)

Status:Needs review» Needs work

The last submitted patch, 1077426_21-make_permissions_work.patch, failed testing.

After patching with #21, add a } on line 228 to fix the syntax error.

Status:Needs work» Needs review
StatusFileSize
new1.2 KB
FAILED: [[SimpleTest]]: [MySQL] 71 pass(es), 69 fail(s), and 0 exception(s).
[ View ]

One more new patch. This one should be good.

Status:Needs review» Needs work

The last submitted patch, 1077426_25-make_permissions_work.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new1.63 KB
PASSED: [[SimpleTest]]: [MySQL] 108 pass(es).
[ View ]

New patch. Added permission to unit test.

Status:Needs review» Reviewed & tested by the community

Looks great & works great.

Version:7.x-1.x-dev» 6.x-2.x-dev
Status:Reviewed & tested by the community» Patch (to be ported)

Look good to me as well :) Committed to 7.x-1.x, thanks!

Is there an update that applies the new permission to roles that have administer menu already? Seems like the last thing to include with a message notifying the admin to adjust their permissions for the new change (if some roles need administer menu attribtues removed).

There's no update, and I don't think it makes a lot of sense to add one. The permission was already there....it just didn't do anything.

Did anybody work on patching this for Drupal 6?
I was a bit confused on all the version changes on this issue.