When the TACL module is enabled, and I set it to allow "View" access for three out of four of our Taxonomy terms, I get duplicates in views based on that taxonomy vocabulary. In other words, if an item is tagged with two of the four Taxonomy terms, and anonymous users are allowed to access content tagged with those two terms, then the item will show up twice in views. Likewise, if it is tagged with three terms that anonymous users are able to access, it will show up three times.

This happens even when "Distinct" is set to "Yes" in the views. Disabling the TACL seems to fix the issue.

Comments

guypaddock’s picture

I forgot to mention that I'm using Views 6.x-2.7. In Views 6.x-3.0-alpha1, they fixed "distinct", so it will work to fix this issue, but it comes with a performance penalty. I don't have to use distinct when I'm not using TACL, so it looks like a TACL issue...

Please fix this, if possible. If you need any additional details, please let me know.

Dave Cohen’s picture

Can you paste here the two queries views generates? One without tac_lite enabled and another with it enabled.

Thanks.

hedac’s picture

I'm having the same issue having duplicates only for anonymous users in nodes that have multiple terms.

this is with TACL enabled creating duplicates for nodes that have multiple terms in a vocabulary:

SELECT node.nid AS nid,
   node.sticky AS node_sticky,
   node.created AS node_created
 FROM node node 
 WHERE (node.status <> 0) AND (node.type in ('story')) AND (node.promote <> 0)
   ORDER BY node_sticky DESC, node_created DESC

and this is without TACL and it is working fine then:

SELECT DISTINCT(node.nid) AS nid,
   node.sticky AS node_sticky,
   node.created AS node_created
 FROM node node 
 WHERE (node.status <> 0) AND (node.type in ('story')) AND (node.promote <> 0)
 GROUP BY nid
  ORDER BY node_sticky DESC, node_created DESC
Dave Cohen’s picture

Is enabling tac_lite really the only difference between those 2 queries?

The queries are different, but not in any way that tac_lite should be responsible for.

Please enable tac_lite, reproduce the problem. Then edit tac_lite.module... change the name of tac_lite_db_rewrite_sql() to be tac_lite_db_rewrite_sql_XXX(), or comment out the whole function. (Either way will prevent drupal from calling it) Then without that hook defined, see if the problem still occurs.

Based on the queries you've pasted, I don't think tac_lite is responsible. But who knows?

hedac’s picture

sorry finally I had time to try it
here is the sequence of things.. I have TACL disabled now and it is working fine

without TACL:

SELECT DISTINCT(node.nid) AS nid,
   node.sticky AS node_sticky,
   node.created AS node_created
 FROM node node 
 WHERE (node.status <> 0) AND (node.type in ('story')) AND (node.promote <> 0)
 GROUP BY nid
  ORDER BY node_sticky DESC, node_created DESC

then I enable TACL module:
I see "The content access permissions need to be rebuilt. Please visit this page."

SELECT DISTINCT(node.nid) AS nid,
   node.sticky AS node_sticky,
   node.created AS node_created
 FROM node node 
 WHERE (node.status <> 0) AND (node.type in ('story')) AND (node.promote <> 0)
 GROUP BY nid
  ORDER BY node_sticky DESC, node_created DESC

now I rebuild permissions:
"The content access permissions have been rebuilt."
go to views again and hit preview and tue query has changed

SELECT node.nid AS nid,
   node.sticky AS node_sticky,
   node.created AS node_created
 FROM node node 
 WHERE (node.status <> 0) AND (node.type in ('story')) AND (node.promote <> 0)
   ORDER BY node_sticky DESC, node_created DESC

edited and commented out tac_lite_db_rewrite_sql()
flushed all caches
go and preview again the query:

SELECT node.nid AS nid,
   node.sticky AS node_sticky,
   node.created AS node_created
 FROM node node 
 WHERE (node.status <> 0) AND (node.type in ('story')) AND (node.promote <> 0)
   ORDER BY node_sticky DESC, node_created DESC

so... we still don't know where is the problem

hedac’s picture

also mention that now if I disable the TACL module...
I can see the DISTINCT in the query again fine. without having to rebuild permissions... I guess it is because there are no permissions module active now, but I still see the rebuild permissions button in the post settings... I don't know why....

Francesco Sottile’s picture

I got the same problem without using the TACL module ..

i guess it's a bug on the view module 6.x-2.7

glennw_d’s picture

I am also seeing the problem. It is clearly and interaction problem between views and tac-lite. I also see no "DISTINCT" when I choose it in the view.

I have not gone as far as hedac and changed the procedure name.

My situation is very similar but it is not only with anonymous users. I have an "Exposure" taxonomy vocabulary with 4 possible values. When the VIEW scheme has 2 Exposure selections for the role and the content has the same 2 selections, the view shows the content twice for that role.

When I change either the content or the VIEW scheme to have a single selection the content is only shown once.

Interestingly the super-user role has all 4 possible values in the scheme for the role but only shows the content once, even though DISTINCT is not part of the query.

Glenn

Dave Cohen’s picture

Status: Active » Closed (duplicate)

I understand this to be not a problem in tac_lite, but Drupal 6.14 core. Try the latest patch in this monster thread #284392: db_rewrite_sql causing issues with DISTINCT.