Q: Disable admin viewing of content on shared database

Events happening in the community are now at Drupal community events on www.drupal.org.
slayerment's picture

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

agentrickard's picture

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

Not a bug

agentrickard's picture

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_sql into 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

I appreciate the response.

slayerment's picture

I appreciate the response. This is what I found as well... Core hack it is.

I appreciate the response.

slayerment's picture

I appreciate the response. This is what I found as well... Core hack it is.

I just had a look at Drupal

slayerment's picture

I just had a look at Drupal 6 and it looks like this issue is fixed in it :).

Backport

Domain Content

agentrickard's picture

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

Multisite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: