All this code looks for is routes that have the word revisions in them, but there could be any number of legitimate uses of that word that don't involve nodes. For example, the Revisions tabs on Commerce entities are defined via Views and have the word "revisions" in them. For obvious reasons, commons_wiki_user_revision_access() is going to fail - these are not nodes, and the entity isn't even passed in to the access callback.

I suppose this alter function should be adjusted specifically to look for node routes that are actually passing node entities to their access callbacks (presumably validated by exploding the route on /, looking for %node, and ensuring their position matches the parameter designated in the route's access arguments array). However, I think a more robust solution would involve selectively applying this alteration to known routes.

Just for reference / searchability, here are the error messages this bug generates:

  • Notice: Trying to get property of non-object in commons_wikis_user_revision_access() (line 71 of /mnt/www/html/staffoutdooredcomdev/docroot/profiles/commons/modules/commons/commons_wikis/commons_wikis.module).
  • Warning: Illegal offset type in node_access() (line 3006 of /mnt/www/html/staffoutdooredcomdev/docroot/modules/node/node.module).
CommentFileSizeAuthor
#3 2222589-wikis-access-menu_alter-3.patch2.01 KBjaperry

Comments

ezra-g’s picture

Priority: Normal » Major

However, I think a more robust solution would involve selectively applying this alteration to known routes.

Agreed. Thanks for the report here.

japerry’s picture

Assigned: Unassigned » japerry
japerry’s picture

Status: Active » Needs review
StatusFileSize
new2.01 KB

After looking through all the menu items, I believe these are the only 2 we really need for this access hook. Tested the patch and it works for authenticated users viewing revisions, but cannot delete or revert them (As expected).

I guess my question for the loop is, was there a use to alter this menu item other than the two items I included in this patch? I couldn't think of any, but I think Ezra would know the answer to that.

  • Commit 48d9ce1 on 7.x-3.x by japerry:
    Issue #2222589 by japerry: Change menu alter for wikis access
    
japerry’s picture

Status: Needs review » Fixed

After reviewing with Ezra-g, this patch looks good and is committed.

Commit here: http://drupalcode.org/project/commons.git/commit/48d9ce1

Status: Fixed » Closed (fixed)

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