Download & Extend

Different $node->path for authenticated vs anonymous users

Project:Drupal core
Version:5.x-dev
Component:path.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

It seems like when an annonymous user is visiting a Drupal site, dumping $node, returns an empty $node->path. When logged in, however, $node->path is effectively setup. The SQL runs fine, can't find out what's wrong with $node->path.

Any ideas?

Comments

#1

The problem is that the path_nodeapi() call that inserts the path attribute ($op = 'load') will never get called for anon users UNLESS they have been granted either 'create url aliases' || 'administer url aliases' permissions!

#2

Version:5.x-dev» 6.x-dev

It feels like we could load the path attribute no matter what permissions the user have. This "bug" is also present in 6.x, so reassigning.

#3

Component:node system» path.module
Status:active» needs review

This patch removes the check for the 'create url aliases' || 'administer url aliases' permissions.

AttachmentSizeStatusTest resultOperations
drupal_6_path_nodeapi_1.patch2.89 KBIgnored: Check issue status.NoneNone

#4

The user_access() check is still needed for every operation that is not "load". Please only remove it for that operation.

Damien

#5

Status:needs review» needs work

#6

Status:needs work» needs review

This patch uses user_access on everything except 'load'.

AttachmentSizeStatusTest resultOperations
drupal_6_path_nodeapi_2.patch2.51 KBIgnored: Check issue status.NoneNone

#7

A bit more elegant.

AttachmentSizeStatusTest resultOperations
drupal_6_path_nodeapi_3.patch787 bytesIgnored: Check issue status.NoneNone

#8

This is my favorite issue of the month. And February just started!

#9

Status:needs review» reviewed & tested by the community

#10

Whoops, I meant to mark it RTBC. Thanks, Moshe.

#11

+1, seems good to go.

#12

Status:reviewed & tested by the community» fixed

Ugh, committed.

#13

Version:6.x-dev» 5.x-dev
Status:fixed» patch (to be ported)

We need a backport for 5.x.

#14

Status:patch (to be ported)» needs review

Moved to the DRUPAL-5 branch.

AttachmentSizeStatusTest resultOperations
drupal_5_path_nodeapi_1.patch730 bytesIgnored: Check issue status.NoneNone

#15

Status:needs review» reviewed & tested by the community

Not much to say: applies cleanly, does what advertised :)

#16

Thank you ever so much for this! I've grown extremely tired of manually loading the alias from the database when I needed it in a node object.

#17

Subscribing

#18

Status:reviewed & tested by the community» fixed

Committed to 5.x.

#19

Status:fixed» closed (fixed)

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

#20

Title:Different $node->path for authenticated vs anonymous users» Isn't fixed in 5.x
Status:closed (fixed)» active

Hi, this is a bug I was interested in back in January, I put a site live having to use drupal_get_path_alias('node/'.nid) to set the path for anon users. I'm just developing a new site and noticed that this issue should be fixed.

I'm using Drupal 5.7 and pathauto 5.x-2.2 and am doing a node_load()

The path is there for me as administrator but not there for anonymous users. I haven't set any permissions for anonymous users but reading through this issue I'm assuming I shouldn't have to.

#21

Status:active» fixed

Correction, this isn't fixed in Drupal 5.7. It will, however, be fixed in Drupal 5.8.... If you look at http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/path/path.module?r... , you'll see that the DRUPAL-5 branch has the fix, while the DRUPAL-5-7 tag (http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/path/path.module?r...) doesn't.

#22

Title:Isn't fixed in 5.x» Different $node->path for authenticated vs anonymous users

Resetting title.

#23

Status:fixed» closed (fixed)

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