Product nodes not showing if administer nodes not enabled for user?

Posts: 6
Joined: 12/17/2007

Hello,
Hopefully this is the right place for this post, I've read through the documentation on this site and I tried searching the forums for any similar issues but couldn't find any reference to my problem.

I've been having problems viewing products that I've created when not logged in with admin rights. After enabling/disabling each permission one-by-one in the user management section, I've narrowed it down to the "administer nodes" permission, it seems like I can only view products if this is enabled. Otherwise, I'll get an "Access denied, You are not authorized to access this page." Has anyone else experienced this? Any ideas on why this is happening, or tips on how to remedy this issue?

Versions I'm running:
drupal 5.3
ubercart 5.x-1.0-alpha8

Thanks,
Wes

Posts: 1920
Joined: 08/07/2007
AdministratoreLiTe!

On the livetest, anonymous users only have the 'access content' permission, plus search. Having 'administer nodes' will override not having 'access content', so make sure that is enabled for everyone you want to see your products.

Posts: 6
Joined: 12/17/2007

Thanks for your response.

This doesn't seem to be the case on my test site. I've had "access content" enabled for anonymous. I just did a test where I created a new role with every permission enabled except "administer nodes." when I log in with a user that has that role, I still cannot see the products. however, once I enable that one permission, then the products will show up.

This only happens with the products, I don't have problems accessing nodes that are of other types.

I'm not familiar with the drupal code, do you know where in the code it checks whether or not to display a node? Maybe I'll be able to see what is causing this condition to fail?

Posts: 6
Joined: 12/17/2007

And to clarify, I only get the "access denied" if I try to go directly to a product node manually. If I go to the catalog, it will show up empty.

Posts: 1920
Joined: 08/07/2007
AdministratoreLiTe!

The function to look for is node_access() in the node.module file. It uses the hook_access() that is implemented in several modules.

Posts: 6
Joined: 12/17/2007

Ok, so I'm taking a look at the node_access() function calls for a product node. It looks like it's failing when it's calling the hook_access() for the uc_product module. Via some var_dump() calls I see that node_access is calling module_invoke() three times, with the $module and $op parameters and the returned value of module_invoke() as:

"uc_product" "view" returns NULL
"uc_product" "update" returns bool(FALSE)
"uc_product" "delete" returns bool(FALSE)

If I look at the uc_product.module's uc_product_access(), it doesn't have a case statement for 'view', it only has cases for 'create', 'update', and 'delete'. Is this how it is supposed to be or should there be an entry for 'view'? If I do manually set this case to TRUE it does seem to work.

Posts: 1920
Joined: 08/07/2007
AdministratoreLiTe!

The idea is that other modules, especially those that deal with the node_access table should get a chance to determine if someone can have access to the node. If uc_product specifies true or false in every case, it would override any rules that would be set up there.

Maybe that's the problem. When Drupal is installed, the node_access table has one row to grant access to all nodes to everybody:

nid gid realm grant_view grant_update grant_delete
0 0 all 1 0 0

Check your node_access table to see if it looks like this. If you've used any modules that affect access, they might have been configured badly.

Posts: 6
Joined: 12/17/2007

Perhaps this has something to do with it. I don't have an entry for nid==0, but I do have entries starting at 1. However, it looks like the nid's that are my products don't have any entries in this node_access table. Am I right to assume that every node in the node table should have an entry in the node_access table? Interestingly, I've tried creating some other content that is not related to ubercart, and I'm having the same issue with that as well, no entry get created in the node_access table which I guess gives me the "access denied" error.

So I guess this may be more a drupal issue than ubercart.

Posts: 6
Joined: 12/17/2007

Looks like I've gotten things working again! Somehow my node_access table must have gotten corrupted (not sure how that happened), but I just tried rebuilding my permissions with:
Administer › Content management > Post Settings > Rebuild Permissions

And that seems to have solved it, the node_access table is now populated with the one entry that you mentioned above, with nid of '0'.

Lyle, Thanks for taking the time to help me get to the bottom of this problem!
Wes

Posts: 6
Joined: 03/11/2008

I was completely stumped on the same problem until I found this post. Might be worth mentioning in the User's Guide.

Posts: 1013
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

I'll be damned. I just had this issue on my dev server (not sure exactly what module caused this to happen) since I'm updating a bunch of modules here.

This is a valuable post - I would never have found that button if it weren't mentioned here. Many thanks.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 16
Joined: 06/09/2008

I can't find the "reset permissions" button anywhere on post settings. I'm having trouble getting users permission to access the search page, and this is the closest thread I could find.

Any ideas why they're getting "Access Denied: you are not authorized to access this page" when they go to the search page? Admin has access; nobody else does.

Thanks for any help.
amy

Posts: 16
Joined: 06/09/2008

I've found the solution to this (like so many other questions I've had, the answer was right there in admin; I just had to find it). In case anyone else is struggling:

Admin>User Management>Access Control

There's a search module there that needs to be enabled for anonymous and authenticated users.

Really, the way Ubercart is set up, every problem I've had so far has been easy to solve, once I found the place to solve it!

Thanks for the hard work on this cart. I appreciate it!
amy