Why is the $user object loaded and used in hook_node_grants? You already have the user object in the $account parameter don't you?

CommentFileSizeAuthor
#1 node_grants_variable_account.diff1011 bytesJacobSingh

Comments

JacobSingh’s picture

Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new1011 bytes

Yes,

I also spent about an hour scratching my head (and banging my computer) over this one today.

Here is a patch. I think this is a critical bug as it breaks the node_access api.

danielb’s picture

It is also in another function earlier in the file with a similar problem possibly.... sorry I should have posted at the time I spotted that.

pwolanin’s picture

Status: Needs review » Reviewed & tested by the community

Yes, I just his this bug too! The proposed change fixes the bug.

blogbold’s picture

Sure there Is no need to have a fallback for $account? (As seen in node.module.)

global $user;

  if (empty($account)) {
    $account = $user;
  }
pwolanin’s picture

node module already does the fallback - there is no need to do it again.

Anonymous’s picture

Status: Reviewed & tested by the community » Fixed

Fixed, will post new dev version shortly.

Status: Fixed » Closed (fixed)

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