Menu OTF needs its own permission

Jaza - November 25, 2005 - 00:50
Project:Drupal
Version:7.x-dev
Component:menu system
Category:bug report
Priority:normal
Assigned:kkaefer
Status:patch (code needs work)
Description

This 2-line patch to menu.module adds a new permission, 'manage menu item when editing a node', which gives users access to the new menu_otf (menu on-the-fly) functionality. At present, menu_otf (which appears as a 'menu settings' fieldset in the node edit screen) relies solely on the 'administer menu' permission. Users should be able to create and edit a menu item for the node that they're adding/editing, without needing the permission for full admin access of the site's menu system.

This patch only affects the menu editing form that appears through hook_nodeapi(). It does not affect anything in the admin/* section of a site.

The only thing that bothers me is the name of the permission: I tried to make it shorter, but couldn't think of a shorter one that made sense. If anyone has better suggestions, please put them forward.

AttachmentSize
menu_otf_perm.patch867 bytes

#1

killes@www.drop.org - November 25, 2005 - 01:12

i think the "administer menu" is just right: You can wonderfully screw up your menus with this function and it shoudl only be used by experienced users. ever had a cycle in your menu? Really nice...

#2

Jaza - November 25, 2005 - 02:44

Maybe you have a point about "administer menu" being just right, killes. At least, it would be "just right" most of the time. But I have some use cases where a user is experienced and trustworthy enough to manage a menu item for their own nodes, but where it is not desirable for them to have access to admin/menu or admin/settings/menu. I don't know if this is a common enough need to warrant it being committed to core. Maybe if we get some more feedback, this will become clearer.

Also: I didn't know that cycles in a menu were possible. I assumed that there was validation to prevent this from happening. If there isn't, this should be filed as a separate issue, as I consider it to be a bug.

#3

Richard Archer - December 3, 2005 - 11:51

You should not be able to create a loop in the menus using the Drupal interface. You can certainly do so by editing the database. This condition could be checked when the menu tree is built, but I seriously doubt it is worth the overhead. If a user breaks their database with phpMyAdmin, let them fix it the same way.

I would like to see the permissions patch developed a little further. I don't know whether it would be deemed core-worthy, but I think it is worth trying. I could certainly make use of this permission on some sites where I want to lock the administration down.

Yes, the text on the access control page is a little vague. My first cut of text would be 'manage menu from edit post form". But that's still not good enough.

There is also now a link to "advanced settings" in the menu-otf panel. This would need to be wrapped in a check for administer menus permissions.

#4

kkaefer - December 13, 2005 - 15:11

+1 on this.

What about naming it "create menu items"?

#5

Dries - December 13, 2005 - 16:00
Status:patch (code needs review)» postponed

I'm not tempted to commit this patch yet because the setting might be somewhat uncommon. Let's evaluate this some more and see if it gets additional support.

#6

Richard Archer - December 16, 2005 - 00:13
Status:postponed» patch (code needs review)

There is another request for this feature at:
http://drupal.org/node/41296

Unlike the feature request for enabling menu_otf for only some types of nodes, this feature can't be added by a module, so it's core or bust.

On the Drupal sites that I have built, this "administer menus for own nodes" permission would be enabled and "administer menus" would be disabled for the "editor" role, which governs the permissions the site owner has. I don't want company directors having access to the full admin/menus screen!

So here's a rerolled patch.

AttachmentSize
menu_otf_perm_0.patch1.36 KB

#7

Richard Archer - December 16, 2005 - 02:03

New patch.

AttachmentSize
menu_otf_perm_1.patch2.03 KB

#8

chx - December 16, 2005 - 06:30

Dries, this feature is very badly needed. It's extremely common that we hand out 'edit own' permission but that's a local, one page change permission. The menu editing is global, affects all pages, therefore you need much more trust for it.

#9

m3avrck - December 19, 2005 - 16:09

I agree, I created that above issue http://drupal.org/node/41296 because I am running into this problem right now with a site that is live running on 4.7 CVS. I need to be able to restrict my 'editors' from being able to edit the entire menu structure, including seeing all of the admin parts!

Right now I have a simple hack that filters this stuff out but I would certainly prefer a new permission 'create menu items' that allows users to be able to create new menu items under the specified menu but *not* have full access to the entire admin menu as well, that should only come if you have 'adminster menu' permission.

With all of the menu enhancements (bravo Richard!) this one is *badly* needed it shouldn't wait.

#10

Richard Archer - December 23, 2005 - 01:43

Ted, did you review this patch? If so, can you mark this issue "ready to be committed".

#11

m3avrck - December 23, 2005 - 04:46
Status:patch (code needs review)» patch (reviewed & tested by the community)

Thoroughly tested, working great! This permission is most certainly needed, two thumbs up!

#12

Jaza - December 25, 2005 - 14:13

Also tested - works really well!

Good on you for remembering to wrap the "edit advanced settings" link in a permissions check, Richard. As far as I can see, this patch is ready to go.

#13

scroogie - January 6, 2006 - 10:46

+1 from me. Im in the same situation where this permission would be desirable.

#14

simon rawson - January 6, 2006 - 11:02

+1 from me too.

I had created the same issue and patch here: http://drupal.org/node/42949

Thanks Richard, for redirecting me!

Simon

#15

Jaza - January 7, 2006 - 07:21

This patch still applies to HEAD, and is still very much waiting to be committed.

#16

killes@www.drop.org - January 17, 2006 - 15:36

This patch has been tested, applies, and needs a decision on whether Dries wants it or not.

#17

m3avrck - January 17, 2006 - 17:32

I really need this permission for all of the sites I work on, as above, tested thoroughly, it's ready to go.

#18

Jaza - January 24, 2006 - 01:26

New patch for latest HEAD (old one still applies, but with offset warnings). No changes. Still waiting to be committed.

AttachmentSize
menu_otf_perm_2.patch2.03 KB

#19

chx - January 24, 2006 - 01:33

So many positive voices and since #6 everyone supports it...

#20

moshe weitzman - January 24, 2006 - 16:44

yup - make sense

#21

m3avrck - January 24, 2006 - 17:06

yes, please commit, i actually need these setting for 3 sites i have going live soon with 4.7 :-)

#22

Crell - January 25, 2006 - 01:42

Here's another +1 voice. Patch looks good, let's commit!

#23

kkaefer - February 5, 2006 - 14:53

I tested the patch again and it works like a charm. Also, it does still apply. Dries, I'd say that this feature is needed on non-community sites very much. I really hope this gets into 4.7.

#24

Dries - February 5, 2006 - 15:48
Status:patch (reviewed & tested by the community)» patch (code needs work)

We don't use 'nodes' in user output.

#25

Dries - February 5, 2006 - 15:49

Isn't the "Restrict parent items to" feature adequate?

#26

kkaefer - February 6, 2006 - 20:11

Dries, what exactly do you mean with "Restrict parent items to" feature?

#27

kkaefer - July 14, 2006 - 21:24
Assigned to:Jaza» kkaefer
Status:patch (code needs work)» patch (code needs review)

Updated the patch against current HEAD. This patch is really urgent as you can't use the menu creation feature without giving users full menu administration rights.

AttachmentSize
menu_otf_0.patch2.07 KB

#28

Jaza - July 15, 2006 - 00:41
Status:patch (code needs review)» patch (reviewed & tested by the community)

Tested against current HEAD, still works great. I see no reason why this can't finally be committed. Can we get it in core, please?

#29

RobRoy - July 15, 2006 - 20:38

+1 for this. For all my web design clients, I want them to just be able to modify menu items for their own nodes and not screw with the admin menu/screen. Good call.

#30

drumm - July 18, 2006 - 07:22
Status:patch (reviewed & tested by the community)» patch (code needs work)

The permission title changed to 'manage own menu items' in the last patch, which concerns me. There isn't a concept of menu item ownership in Drupal, and this patch doesn't add it.

My best idea is 'edit menu items on posts.'

Otherwise this looks like it should be ready to go.

#31

kkaefer - July 18, 2006 - 18:18

Changed the name of the permission.

We really need help texts/descriptions for permissions. Probably these can get into the *.help files?

AttachmentSize
menu_otf_1.patch2.08 KB

#32

drumm - July 18, 2006 - 18:30
Status:patch (code needs work)» patch (code needs review)

#33

kkaefer - August 26, 2006 - 09:38

With the forms #access patch, this patch is now even smaller. Updated the patch and tested it. Works fine.

AttachmentSize
menu_otf_2.patch1.61 KB

#34

m3avrck - February 6, 2007 - 20:39
Version:x.y.z» 6.x-dev

Bump for consideration in 6.x, this would be a really useful feature. Patch probably does not apply more.

#35

keith.smith - June 23, 2007 - 22:57
Status:patch (code needs review)» patch (code needs work)

:( patch no longer applies.

# patch -p0 < menu_otf_2.patch
patching file modules/menu/menu.module
Hunk #1 FAILED at 152.
Hunk #2 succeeded at 35 (offset -144 lines).
Hunk #3 succeeded at 707 with fuzz 2 (offset 506 lines).
Hunk #4 FAILED at 762.
2 out of 4 hunks FAILED -- saving rejects to file modules/menu/menu.module.rej

#36

ronnqvist - September 7, 2007 - 21:25

I agree this feature should be implemented into Drupal, preferably even before 6.0.

I'm right now researching how well Drupal adapts for really small sites with just a few pages, it'd actually do pretty well if it wasn't for this. I need to work around this problem for the time being, cause I don't want to learn and use yet another CMS (like Joomla) just becuase many customers want simple sites. I want to keep all options open for customization by using Drupal. ;)

I was thinking of using Taxonomy instead, but then again I'd need to find a way to make a block out of it. And using Taxonomy for this very simple purpose seems a bit confusing.

#37

Pancho - February 8, 2008 - 07:44
Category:feature request» bug report

Feature requests need to go to D7. However this has been supported by that many respected core developers, that we should see it as a badly needed fix to a usability bug. Here's an untested, rerolled version.

AttachmentSize
menu_otf_37.patch869 bytes

#38

Richard Archer - February 8, 2008 - 09:32

Two years on and Dries' comments on this patch still crack me up!

Thanks Pancho... I really needed a laugh today :)

#39

Pancho - May 14, 2008 - 02:38
Version:6.x-dev» 7.x-dev

Bug or feature, whatever. Needs to be done in D7, though.

#40

pwolanin - June 15, 2008 - 15:37

I think you can do this now with a form alter (though you might have to weight your module). Look at what menu_module does:

http://api.drupal.org/api/function/menu_form_alter/6

it's properly uses #access - so you can set that back to TRUE based on whatever condition you like.

 
 

Drupal is a registered trademark of Dries Buytaert.