Closed (works as designed)
Project:
Domain
Version:
5.x-1.0rc4
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
31 Jan 2008 at 02:25 UTC
Updated:
5 Aug 2011 at 18:16 UTC
When I set the "Default Front Page" setting to "node", it displays content from all sites. It would be nice if it only displayed content for the local site.
Comments
Comment #1
agentrickardAre you viewing that page as a user with the "administer nodes" permission?
Comment #2
agentrickardComment #3
wayland76 commentedYes.
Comment #4
agentrickardNode access rules do not apply to users with 'administer nodes' permissions. There is nothing that can be done about that.
Please read the documentation. Particularly, sections 3.4 and 5.5
This is a core Drupal behavior. For technical reference, see http://api.drupal.org/api/function/node_access/5. Especially the lines:
That overrides any other setting and grants access to users with 'administer nodes.'
Comment #5
wayland76 commentedComment #6
wayland76 commentedThanks for the detailed explanation. I was hoping to get back to further testing on this before you responded.
I've discovered that, even as an anonymous user, I still have the same problem.
I seem to recall that this worked with the multidomain module (which supposedly has some of the same functionality as yours, but unfortunately is not maintained). I have a lurking suspicion that the relevant piece of code is the function titled "multidomain_db_rewrite_sql", in particular the lines that read:
$return['join'] = 'INNER JOIN {term_node} multidomain_tn ON multidomain_tn.nid = '. $primary_table .'.nid';
$return['where'] = 'multidomain_tn.tid = '. $domain['tid'];
HTH,
Comment #7
agentrickardDo you still have MultiDomain turned on?
It may be that MultiDomain is granting node access, which would account for the behavior. Unless you applied the "multiple node access" patch and expecitly set Domain Access to use the "AND logic" if one node access module grants access, it cannot be removed.
Comment #8
wayland76 commentedNo, multidomain is turned off. And in re-reading my comment, i can see that it doesn't say at all what I wanted to say. So I'll try again, and maybe I'll write something sensible this time.
I suspect that it would be possible to overcome the limitation that you've listed as the second one there (about being able to see all content on all domains). The way I think this might be alterable is by code similar to that mentioned in my previous comment.
Comment #9
agentrickardPossibly. But that is not what is currently implemented, and it's too late to change before the first release.
After looking at the code, I believe -- but could be wrong -- that multidomain can do this because it uses taxonomy terms to store its data. Therefore it can add a JOIN to the {term_node} table to any node query.
But for node_access modules, the queries already get run through {node} and {node_access}, so you'd have to test if and where the JOIN syntax could be applied.
OG, for example, only uses db_rewrite_sql() in cases where external modules want to load nodes based on OG groups. The module itself relies on {node_access}.
My opinion is that this is a limitation of the current node_access system. You could try implementing hook_db_rewrite_sql(). http://api.drupal.org/api/function/hook_db_rewrite_sql/5. Perhaps something like this would work:
You might try pasting that into the module and seeing what happens. Use the Devel module to show the queries that result.
Comment #10
wayland76 commentedBewdy, mate! Works a treat :).
In case you're intending to use the code (or if anyone else is), the "where" line needs changing to:
You'll notice the changed quotation marks.
Comment #11
wayland76 commentedI particularly like this solution, as it also means that the XML sitemap module doesn't produce duplicate content (well, once XML sitemap is patched to work with multiple domains :) ). I know that any changes won't make it into the first release, but is there anything else that needs to happen to get this patch into the CVS HEAD for the next release? I can turn it into a CVS patch if that makes a difference to you. Hmm. You'll probably want it to be optional, controlled from the admin panel, right?
Thanks a lot for this -- it solved all the final problems before I can start focussing on the content of my site instead of the setup.
Comment #12
agentrickardXML sitemap should not produce duplicate content. Install the 'custom_url' patch and code. Then add 'xmlsitemap' to the 'special page requests' setting.
Note that this issue no longer appears on my radar, so you'll need to open new issues.
Comment #13
agentrickardHere's a proper version of the function:
Ideally, this would then have a module setting, enabling the if to include:
Comment #14
wayland76 commentedOk -- as I said, it's all working just the way I want, so I'm in no hurry of any sort :). I should also point out (in case anyone else is trying to use the code that I pasted in) that I used "domain_access_da" instead of just da in the join part. This is because the Multidomain module used "tn" as an alias, and so did another one (XML Sitemap, maybe?), and there were errors all over the place. So now I'm careful about trying to get unique table alises.
Comment #15
agentrickardI am a little unsure about how table prefixing might affect what you wrote, and since da was still used in the [JOIN]. Here's some compromise code.
Comment #16
agentrickard