Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Is it possible to have permissions added to have access to menu attributes?
Comment | File | Size | Author |
---|---|---|---|
#27 | 1077426_27-make_permissions_work.patch | 1.63 KB | cweagans |
#25 | 1077426_25-make_permissions_work.patch | 1.2 KB | cweagans |
#21 | 1077426_21-make_permissions_work.patch | 1.24 KB | cweagans |
#19 | make_permissions_work.patch | 1.24 KB | cweagans |
#12 | 1077426-menu_attributes_permission-12.patch | 2.25 KB | amateescu |
Comments
Comment #1
kevinquillen CreditAttribution: kevinquillen commentedComment #2
rickupdegrove CreditAttribution: rickupdegrove commentedI am also looking for this feature.
Comment #3
Dave ReidI'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.
Comment #4
kevinquillen CreditAttribution: kevinquillen commentedSeparation. 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?
Comment #5
Dave ReidAnyone 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.
Comment #6
kevinquillen CreditAttribution: kevinquillen commentedI 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.
Comment #7
mErilainen CreditAttribution: mErilainen commented+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.
Comment #8
kevinquillen CreditAttribution: kevinquillen commentedHere 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.
Comment #9
kevinquillen CreditAttribution: kevinquillen commentedNoticed a typo in the hook_perm in previous patch. Resubmitting
Comment #10
amateescu CreditAttribution: amateescu commentedI 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.
Comment #11
Dave ReidThis 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.
Comment #12
amateescu CreditAttribution: amateescu commentedNice! 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.
Comment #14
amateescu CreditAttribution: amateescu commented#12: 1077426-menu_attributes_permission-12.patch queued for re-testing.
Comment #15
amateescu CreditAttribution: amateescu commentedCommited #12 without the 'Implements hook_update_N()' doxygen to 7.x-1.x.
http://drupalcode.org/project/menu_attributes.git/commit/4dbf8c2
Comment #16
amateescu CreditAttribution: amateescu commentedComment #17
kevinquillen CreditAttribution: kevinquillen commentedFor 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?
Comment #18
kevinquillen CreditAttribution: kevinquillen commentedNevermind- I see now. I misread one post and saw the status change in the other.
Thanks for the progress here all.
Comment #19
cweagansNot 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.
Comment #21
cweagansAhem. With correct PHP syntax this time.
Comment #22
amateescu CreditAttribution: amateescu commentedIs it me or this is the same patch? :)
Comment #24
phenaproximaAfter patching with #21, add a } on line 228 to fix the syntax error.
Comment #25
cweagansOne more new patch. This one should be good.
Comment #27
cweagansNew patch. Added permission to unit test.
Comment #28
dalinLooks great & works great.
Comment #29
amateescu CreditAttribution: amateescu commentedLook good to me as well :) Committed to 7.x-1.x, thanks!
Comment #30
kevinquillen CreditAttribution: kevinquillen commentedIs 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).
Comment #31
cweagansThere'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.
Comment #32
Stolzenhain CreditAttribution: Stolzenhain commentedDid anybody work on patching this for Drupal 6?
I was a bit confused on all the version changes on this issue.
Comment #34
joelpittetClosing to triage the issue queue, likely won't be patching 6.x at this point.