Hi,

I have a node which I 'send to all affiliates'.
This node shows up in a view on the domain the node was published as expected (this is the primairy domain).

Yet, I use the same view on all other sub domains and here the node isn't listed in the view, eventhough 'send to all affiliates' was checked.
But when I individually check all the subdomains to publish the node to in the node/edit form the node IS listed in the view.

If I'm not mistaken this was working correctly before updating to rc9.

Has anything changed?

Cheers

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Bartezz’s picture

Possibly related to: http://drupal.org/node/301662

But is there a fix for this, it's a pain to check 40-some affiliates each time you publish a node ;)
Besides I thought I had it working with previous versions!

Cheers

Bartezz’s picture

Well I reverted to rc8 and that didn't fix it :(

The weird thing is, if I don't check any affiliates but do check 'send to all affiliates' I won't get the nodes to show up in my view with 'Domain Access: Available on current domain True', yet if I call the node by pasting it's path after the affiliate's domain I do have access to it. The access is dropped as soon as I uncheck 'send to all affiliates'.

Would be nice to have it fixed :)

Cheers

Bartezz’s picture

Been digging a bit in domain_views_handler_filter_domain_access_current_all.inc.

And what I found is that somehow $table.realm = 'domain_site' messes stuff up.

I've altered the inc on line #22 to

$this->query->add_where($this->options['group'], "(($table.realm = 'domain_site'))");

which basically changes the query to

WHERE (node.status <> 0) AND (node.type in ('nieuwsbericht')) AND (((domain_access.realm = 'domain_site')))

To me that reads; a published node of the content type nieuwsbericht where the value of the realm column within the domain access table equals 'domain_site'.

Well that's all true for my node #17 yet it will not show in my view on any other than the affiliates that are explicitly checked eventhough I check "send to all affiliates" :'(

This is the whole query

SELECT node.nid AS nid,
   node.title AS node_title,
   node_revisions.teaser AS node_revisions_teaser,
   node_revisions.format AS node_revisions_format,
   node_data_field_datum.field_datum_value AS node_data_field_datum_field_datum_value,
   node.type AS node_type,
   node.vid AS node_vid,
   node.sticky AS node_sticky
 FROM sgz_node node 
 LEFT JOIN sgz_domain_access domain_access ON node.nid = domain_access.nid AND domain_access.realm = 'domain_id'
 LEFT JOIN sgz_node_revisions node_revisions ON node.vid = node_revisions.vid
 LEFT JOIN sgz_content_field_datum node_data_field_datum ON node.vid = node_data_field_datum.vid
 WHERE (node.status <> 0) AND (node.type in ('nieuwsbericht')) AND (((domain_access.realm = 'domain_site')))
   ORDER BY node_sticky ASC, node_data_field_datum_field_datum_value DESC

Reckon this is the baddy; LEFT JOIN sgz_domain_access domain_access ON node.nid = domain_access.nid AND domain_access.realm = 'domain_id'
Which is hardcoded in domain_views.views.inc on line #120

Don't know how to fix though!

Cheers

agentrickard’s picture

Status: Active » Closed (duplicate)

Yes. This is a bug, and a nice description of what is happening here -> #561282: Views are filtered out even if filter is not set

Bartezz’s picture

Hi Agentrickard,

The issue you are refering to seems not very active. Could you please please help me on this one?
I've really given it a shot but just can't seem to fix it... grrrrr need more SQL knowledge!!!!

Anyway, I have created my primary domain and filled it with content (confident of this bug being fixed by now).
Now I have to create numerous subdomains which should all be showing all the news content of the primary domain (send to all affiliates).
Unless this bug is fixed, I have to go into every one of the hundreds of news nodes and check all of the dozens of new subdomains individually to get the news to be published on these subdomains...
And will have to do so every time a new subdomain is created :(

Almost begging here!
Cheers,
Bartezz

seren10pity’s picture

Project: Domain » Domain Views
Version: 6.x-2.0-rc9 » 7.x-1.4
Category: support » bug
Priority: Critical » Major
Status: Closed (duplicate) » Needs work

Hi,
same problem here.
I think that the problem in the query comes from here : LEFT JOIN sgz_domain_access domain_access ON node.nid = domain_access.nid<strong> AND domain_access.realm = 'domain_id'</strong>
It causes searching only on domain_access table rows that have realm = 'domain_id', when the where clause ask for rows that have realm = domain_site.
Tee problem is in Left join ON clause, not WHERE.

I choose to tweak (bad way) the domain_views module, removing every reference to "$table.realm" when associated with 'domain_id'.
Now, my view is working: filter "Domain Access: Available on current domain True" returns only nodes that have the right domain id, or the "All affiliates" setting enabled.

However, you shouldn't do the same unless know exactly what you're doing, because I don't know if what I did won't break other functionnalities ofthe module.
If someone can solve this neatly, I would be eternally grateful to him ;)

Thanks !

agentrickard’s picture

Status: Needs work » Postponed (maintainer needs more info)

Steps to reproduce, please. An exported View would help. This is a long-dead issue and I have no context for it.

scotthorn’s picture

I encountered the same problem, and made a patch that I think solves it. I'm not totally familiar with all this module has to offer, though, so it could have unintended consequences. Here are steps to reproduce:

1) Create a Drupal install with more than one domain (I'll call the first two A & B).
2) Add a node with "Published to All Domains" checked and only domain A checked below it.
3) Create a node view page and add the "available on current domain" filter.
4) Look at the page on both domain A and domain B.

Like seren10pity mentioned, the view is joining against the domain_access table with the nid column, but also makes realm="domain_id". Nodes that are published to all domains get "domain_site" in that column and are being automatically excluded.

agentrickard’s picture

Status: Postponed (maintainer needs more info) » Active

Thanks @scotthorn.

agentrickard’s picture

Status: Active » Needs review

Proper status for the patch.

Mac_Weber’s picture

Status: Needs review » Needs work

It seems to be working fine for value = TRUE.
It is not working for value = FALSE because the view must use Disable SQL rewriting. Disabling SQL rewriting also disables the changes the patch makes.

Is it possible to override the access restrictions imposed by Domain and list the content from other domains in case value = FALSE?

agentrickard’s picture

Contextually, no, I don't think so.

Mac_Weber’s picture

@agentrickard maybe in case of FALSE we could disable Domain module calling hook_query_TAG_alter(). I did some tests disabling it, but the results in case of value = FALSE still need to be reworked to return the correct list.

I am not sure how to disable Domain module calling hook_query_TAG_alter() by depending of the value on this view filter. On my tests I did it on a custom module by using hook_module_implements_alter(). It was just for testing, of course.

If it is not possible to disable the hook call, how about undoing the changes made by domain_query_node_access_alter()? - this is hook_query_TAG_alter()

agentrickard’s picture

Look at the logic in domain_admin_filter(). domain_query_node_access_alter() only runs for very specific users under very specific conditions. Essentially, it only runs for user 1 and users who can "bypass content access." It is meant to help users with debugging/previewing.

And even then, it only runs if you enable the feature, which I added because the fact that some users/roles ignore node access rules was very confusing to some people.

If we wanted to disable it for a single query -- which I don't -- we would remove the static $return call in that function and set $conf['domain_force_admin'] = FALSE in the query method of the handler.

alexanderpas’s picture

A pragmatic solution might be to split the "published to current domain" and the "published on all domains" as 2 separate conditions.

This'll allow for more advanced options such as "published to current domain" AND NOT "published on all domains", or only those "published on all domains".

fredeee’s picture

Hi

recently started using drupal 7.22 and DV 7.x-1.5.
just confirm have this issue using views.
when value set = true content/nodes do not display in views for users when have been flagged 'Send to all affiliates' in content settings.
as soon as check/flag individual domains in 'publish to' content/node displays ok to user.
have not tried applying the patch above at this point.

cheers

alexanderpas’s picture

bibo’s picture

Issue summary: View changes

In my opinion #1276694: Filter 'Domain Access: Available on current domain' - 'All Affiliates' issue is definitely a duplicate of this (long standing!) issue. This one is almost 5 years old, while that one is "only" closer to 3 years.

I think this issue might still be the one that should be set as duplicate, because this patch, #19 is more complete and probably addresses more issues.