As a site map is thought to be used by search engines, xmlsitemap_node should check if the anonymous user has the permission to view the node whose link is being added to the site map.
It's enough to call node_access() passing 'view', the node object that must be checked, and the object representing the anonymous user account (obtained by user_load()).

Comments

avpaderno’s picture

An alternative is to execute the hook_xmlsitemap_links() implementations only when the current user is the anonymous user.

avpaderno’s picture

Version: 5.x-2.x-dev » 6.x-1.x-dev
Component: xmlsitemap_node » Code
avpaderno’s picture

Title: Check if anonymous user can view the node added to the site map » Check if anonymous user can view the links added to the site map
Issue tags: +Hook implementations

This has been implemented in CVS; the menu callback that outputs the site map, and which is the one to call the implementations of hook_xmlsitemap_links(), is accessible only to anonymous users.

This change should be ported to the Drupal 5 branch.

avpaderno’s picture

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

I forgot to change the referring version.

avpaderno’s picture

Status: Active » Fixed

The code has been changed in the same way it has been changed in the Drupal 6 branch.

avpaderno’s picture

Issue tags: -Hook implementations +custom hooks

I am changing the issue tags.

Status: Fixed » Closed (fixed)
Issue tags: -custom hooks

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