Posted by slayerment on October 6, 2007 at 3:00am
I am currently running a shared database set up for a few domains. I am sharing most of the core things like nodes, comments and taxonomy.
This works great and I am able to lock certain sites out of viewing content by using hook_db_rewrite_query().
The problem comes when viewing admin pages. For some reason it looks as though the admin pages do not rewrite their queries and as a result I am shown all the nodes in the database no matter what domain I am browsing from. The same things happens with comments and taxonomy and anything else that is shared.
Is there a way to only display domain specific content at the admin level?
Thanks,
Quinton

Comments
Hm
It looks as though the admin content screen does not implement
db_rewrite_sql, which could be considered a bug.See http://api.drupal.org/api/function/node_admin_nodes/5
The Domain Access module should, in theory, allow this separation as long as the user looking at the page does not have the 'administer nodes' permission.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
Not a bug
More like a design decision. I did a little check. The menu hook in node.module assumes that you can view all nodes.
$items[] = array('path' => 'admin/content/node',
'title' => t('Content'),
'description' => t("View, edit, and delete your site's content."),
'callback' => 'node_admin_content',
'access' => user_access('administer nodes')
);
So even with Domain Access, users who can see this page can see all nodes, since the node_access() check will always return TRUE.
http://api.drupal.org/api/function/node_access/5
So the fix, I think, is to insert
db_rewrite_sqlinto the query:$result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC', 50, 0, NULL, $filter['args']);But that would be a core hack.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
Comments
Same appears to be true for comments, and likely for taxonomy.
http://api.drupal.org/api/function/comment_admin_overview/5
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
I appreciate the response.
I appreciate the response. This is what I found as well... Core hack it is.
I appreciate the response.
I appreciate the response. This is what I found as well... Core hack it is.
I just had a look at Drupal
I just had a look at Drupal 6 and it looks like this issue is fixed in it :).
Backport
You could probably backport the fix and post it as a patch.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/
Domain Content
FWIW: For the Domain Access module group, there is a Domain Content module that handles this interface.
--
http://ken.therickards.com/
http://savannahnow.com/user/2
http://blufftontoday.com/user/3
--
http://ken.therickards.com/