Problem/Motivation

? wrong permission for admin/structure/menu/parents

Proposed resolution

? Use administer menu permission

Remaining tasks

User interface changes

No.

API changes

No.

Original report by @tsvenson

Taking alpha 6 for a test spin and got a weird access denied when logged in as user with administrator role (all permissions ticked).

Type       access denied
Location   http://d7/admin/structure/menu/parents
Referrer  http://d7/admin/structure/types/manage/page?render=overlay
Message   admin/structure/menu/parents
Severity   warning

When I tried the location URL I got access denied as the same user. Then I logged in as user 1 and this time I was prompted with a download (Firefox 3.6.6) for parents of a "application/json" type.

When looking at that file it contained only "[]" nothing else.

Sorry but I have no idea where this is coming from, hope its enough though.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

int’s picture

Version: 7.0-alpha6 » 7.x-dev
Priority: Normal » Critical
webchick’s picture

Priority: Critical » Normal

Er, no. Unless we can track this down to something pervasive in the system, this is just normal.

Can anyone reproduce this?

Stevel’s picture

Priority: Normal » Critical
Status: Active » Needs review
FileSize
666 bytes

access arguments for admin/structure/menu/parents is set to array(TRUE), which is no permission to be granted by user_access, so that returns access denied by anyone but user 1.

Getting a JSON-file looks correct to me.

This patch sets the permission to administer menu, the same as the other menu items at admin/structure/menu/*

edit:
sorry, crosspost.
I'm not sure why it had TRUE as a permission though, was it just a mistake, or is it there intentionally?

Stevel’s picture

Title: Weird Access Denied » wrong permission for admin/structure/menu/parents
Stevel’s picture

Priority: Critical » Normal

And this is normal as it doesn't prevent usage of anything really, just allows an administrator to select a default parent item that's not in one of the selected menus on admin/structure/types/manage/page (under Menu Settings).

To reproduce, just visit admin/structure/types/manage/page and view the menu settings. The error then shows up in the log.

Heine’s picture

Status: Needs review » Reviewed & tested by the community
rfay’s picture

Version: 7.x-dev » 8.x-dev
Status: Reviewed & tested by the community » Needs review

D8 first. Let's get these fixed on D8 and into D7.

oriol_e9g’s picture

FileSize
512 bytes

D8 roll.

oriol_e9g’s picture

Issue tags: +Needs tests

Would be good to write a test.

Chris Pergantis’s picture

Version: 8.x-dev » 7.10

I had a couple of log entries that revealed this same behavior (Top 'access denied' errors ), but the site is on D7 not D8. As stated above I go to the URL and all I get is the double brackets. Just an FYI - perhaps this issue is a legacy from D7?

Chris Pergantis’s picture

Version: 7.10 » 8.x-dev

returning your posts to D8

oriol_e9g’s picture

@cperg We fix first all bugs in D8 and then we backport the solution to D7, this is our normal process.

Chris Pergantis’s picture

it was just a heads up - didn't expect your process to be different from what you stated.

amanaplan’s picture

sub

Alan Evans’s picture

Note - steps to reproduce the bug in the UI:

  1. Log out of any user 1 account
  2. Log into a superadmin user account with access to everything
  3. Start on admin/structure/types/add
  4. Click the "Menu settings" vertical tab
  5. Check and uncheck "available menus" at random
  6. Note that the "default parent item" does not update
  7. Check chrome/firebug network tab and note ajax requests to admin/structure/menu/parents all return 403 Access Denied
Alan Evans’s picture

Added a failing test for this: https://skitch.com/e-alanevans/8q2du/test-result-testd85.localhost

Test result after patching: https://skitch.com/e-alanevans/8q2ry/test-result-testd85.localhost ... https://skitch.com/e-alanevans/8q2rb/test-result-testd85.localhost

Patch including test attached. Leaving in review for now - the test itself needs review, and I'm not 100% sure that "administer menu" is the correct permission for this: The feature only shows up on a node type creation form, so in the sense of the items returned by the callback it's related to menu admin, and in the sense of where the data is used, it's only related to node type admin. To make this callback useful, you first need access to create new content types, and to see the menu items you also need permission to view all those menu items (which is only guaranteed for menu admin).

On the other hand, maybe the only reasonable permission for the data returned by the callback itself is menu admin, as menu admins are the only users who should be able to see all menu items.

arelem’s picture

Version: 8.x-dev » 7.12
Assigned: Unassigned » arelem
Priority: Normal » Major

April 1 2012
Yes I am running into this all the time in Drupal 7.12, it prevents the use of some Node References and prevents the use of .

I have Page, Article, Event, Contact, Date and Test2 Content Types.
I have 2 views for Contacts which display first name only and full name. These show as drop down fields in the Event form but no selection is entered into the database, content type or view.

With "Content types that can be referenced", Page and Article work ok, but any other created Content Types do not work.

A further problem is that some Content types do not display in the selector, this too produces error message. The Content type is selectable from a user menu however.

catch’s picture

Version: 7.12 » 8.x-dev
Assigned: arelem » Unassigned
Priority: Major » Normal
Issue tags: -Needs tests

Changing the version back to 7.x makes this less rather than more likely to get fixed, see http://drupal.org/node/767608

Not sure about the permissions either, should it be administer node types + menu admin?

dawehner’s picture

Not sure about the permissions either, should it be administer node types + menu admin?

This kind of javascript could be be used by other modules so i would think that just "administer menu" is enough.

Alan Evans’s picture

Makes sense - using just "administer menu" keeps this callback decoupled from where it's used, so that the permission just expresses the level of access that you should have in order to view all of the data that it returns. Although it's only used in one place that we know of, there is potential for it to be used elsewhere.

+1 then for keeping "administer menu"

kscheirer’s picture

#16: 849624-menu-parents-access.patch queued for re-testing.

kscheirer’s picture

Retesting against latest HEAD since it has been over a year.

Status: Needs review » Needs work

The last submitted patch, 849624-menu-parents-access.patch, failed testing.

brad.bulger’s picture

Status: Needs work » Needs review
FileSize
1.35 KB

reroll of patch from 16 against 8.x - moved test into MenuTest.php. that test passed when i tried the patch on a local install.

dawehner’s picture

+++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.phpundefined
@@ -673,4 +673,16 @@ private function verifyAccess($response = 200, $menu_name = 'tools') {
+  function testMenuParentsJsAccess() {

This should be marked as public. Additional we should check that a user without the permission does not have access

brad.bulger’s picture

redid patch against latest 8.x, and added 'public' to this patch's test function. i didn't change the other plain 'function' declarations in MenuTest.php, that seemed out of scope. i also added some lines to check for a 403 return to an unprivileged standard user. Alan or someone with more experience with writing tests should probably review that code. it worked when i tried it on a local install.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you!

YesCT’s picture

Issue tags: +RTBC July 1

This issue was RTBC and passing tests on July 1, the beginning of API freeze.

catch’s picture

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

Committed/pushed to 8.x.

Moving to 7.x for backport.

David_Rothstein’s picture

@mikeytown2 has the start of a patch in #1633130: Path admin/structure/menu/parents returns 403 unless UID=1 (which I closed as a duplicate), but the test isn't backported yet.

memcinto’s picture

How is it that this still hasn't been applied to 7.x? Every time I update core I have to go and manually patch the menu module on each of my 50+ drupal sites. Annoying.

webchick’s picture

Because instead of uploading a D7 patch for review, which could then be RTBCed and committed, people keep manually patching menu module on their D7 sites. :)

milos.kroulik’s picture

Issue summary: View changes

#32 Well, patch mentioned in #30 seems to be working fine. Maybe it would be way to go?

YesCT’s picture

added instructions for doing a backport.

dcam’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.4 KB

Backported #26 to D7.

mikeytown2’s picture

Patch looks good +1 for RTBC.

dcam’s picture

For any potential reviewers: steps to reproduce the issue are in #15.

dcam’s picture

Status: Needs review » Reviewed & tested by the community

I know I normally shouldn't do this to my own patch, but we had one person RTBC it. I think that's all the RTBCing it's going to get.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 35: menu-parents-access-849624-35.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 35: menu-parents-access-849624-35.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 35: menu-parents-access-849624-35.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 35: menu-parents-access-849624-35.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 35: menu-parents-access-849624-35.patch, failed testing.

Status: Needs work » Needs review
mikeytown2’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 35: menu-parents-access-849624-35.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 35: menu-parents-access-849624-35.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community
David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x - thanks!

  • David_Rothstein committed 2e235b5 on 7.x
    Issue #849624 by brad.bulger, dcam, Alan Evans, oriol_e9g, Stevel |...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.