Different $node->path for authenticated vs anonymous users

Rob Loach - January 31, 2008 - 18:17
Project:Drupal
Version:5.x-dev
Component:path.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

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?

#1

budda - January 31, 2008 - 18:19

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

Damien Tournoud - February 1, 2008 - 08:23
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

Rob Loach - February 1, 2008 - 15:44
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 KBIgnoredNoneNone

#4

Damien Tournoud - February 1, 2008 - 19:30

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

Damien

#5

webchick - February 1, 2008 - 21:18
Status:needs review» needs work

#6

Rob Loach - February 1, 2008 - 23:32
Status:needs work» needs review

This patch uses user_access on everything except 'load'.

AttachmentSizeStatusTest resultOperations
drupal_6_path_nodeapi_2.patch2.51 KBIgnoredNoneNone

#7

Rob Loach - February 1, 2008 - 23:37

A bit more elegant.

AttachmentSizeStatusTest resultOperations
drupal_6_path_nodeapi_3.patch787 bytesIgnoredNoneNone

#8

Christefano - February 2, 2008 - 02:54

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

#9

moshe weitzman - February 2, 2008 - 03:51
Status:needs review» reviewed & tested by the community

#10

Christefano - February 2, 2008 - 05:30

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

#11

Damien Tournoud - February 2, 2008 - 14:56

+1, seems good to go.

#12

Gábor Hojtsy - February 3, 2008 - 19:20
Status:reviewed & tested by the community» fixed

Ugh, committed.

#13

Damien Tournoud - February 3, 2008 - 23:52
Version:6.x-dev» 5.x-dev
Status:fixed» patch (to be ported)

We need a backport for 5.x.

#14

Rob Loach - February 4, 2008 - 08:46
Status:patch (to be ported)» needs review

Moved to the DRUPAL-5 branch.

AttachmentSizeStatusTest resultOperations
drupal_5_path_nodeapi_1.patch730 bytesIgnoredNoneNone

#15

Damien Tournoud - February 4, 2008 - 10:56
Status:needs review» reviewed & tested by the community

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

#16

Arancaytar - February 6, 2008 - 11:14

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

mzafer - February 10, 2008 - 05:40

Subscribing

#18

drumm - February 11, 2008 - 05:12
Status:reviewed & tested by the community» fixed

Committed to 5.x.

#19

Anonymous (not verified) - February 25, 2008 - 05:12
Status:fixed» closed

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

#20

tommo - June 13, 2008 - 15:59
Title:Different $node->path for authenticated vs anonymous users» Isn't fixed in 5.x
Status:closed» 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

Rob Loach - June 13, 2008 - 16:08
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

webchick - June 13, 2008 - 16:11
Title:Isn't fixed in 5.x» Different $node->path for authenticated vs anonymous users

Resetting title.

#23

Anonymous (not verified) - June 27, 2008 - 16:12
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.