Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The documentation mentions the following:
Organic group members with the right permission can also manage menus at node/[nid]/og_menu.
I have not been able to get this to work under D7. Which permission is needed? Even for the admin with uid 1 I get 'Permission denied' when I try to access this path.
Comment | File | Size | Author |
---|---|---|---|
#3 | 1307238-1-og_menu-permission.patch | 1.17 KB | pfrenssen |
Comments
Comment #1
rv0 CreditAttribution: rv0 commented"Administer OG menus"
on admin/people/permissions
Comment #2
rv0 CreditAttribution: rv0 commentedNo feedback, so this should be marked fixed
Comment #3
pfrenssenYour reply in #1 adequately answered this question for me so I did not reply ;)
Looking back at it it would perhaps be nice if this was explained properly in the documentation. The permission is mentioned elsewhere in the Readme but not for this particular section.
Proposed fix attached.
The readme can also use some formatting and spelling improvements, but that's another issue.
Comment #4
pfrenssenLooking at og_menu_access() and reading my original request I think I know what caused my confusion.
og_menu_access() does more than just check access rights. It also checks if the given node exists and if it is a group type. If this is not the case it returns a 403 Access Denied. This is not the right response, it should be a 404 Page Not Found.
The problem is that this function is trying to do two things at once: it is checking access AND it is validating input. This is a Code Smell® :) From my original request I can tell that I thought I stumbled on a bug since I was logged in as UID1 and got an access denied. UID1 should have access to everything and should never be served any access denied responses.
Shall I make a new issue out of this?
Comment #5
rv0 CreditAttribution: rv0 commentedCommitted an edited version, thanks for the help.
Yes, there are many things in the code that could be done in a better way. Patches are always welcome in a new issue.
The sad part about major code changes (to eliminate code smell) is that they need a lot of testing because of all the possible usecases.