Hi,
I am using views 7.x.3-0-rc3 and access control 7.x.1-2-beta1 modules
This is the scenario:
- Content type has content_access override at the node level
- Content access override gives "view any content" access to 2 different roles
- User has both of these roles
- A view is aggregating this content type, and summing up one of its fields
What happens?
- The view shows double the sum for this user
- All other users see the correct amount
Solution:
I think the problem here is that the SQL beeing generated is doing INNER JOIN with node_access table, and the condition is
( (na.gid = 'role1') AND (na.realm = 'content_access_rid') )OR( (na.gid = 'role2') AND (na.realm = 'content_access_rid')).
That's why the value appears duplicated, because both rows from node_access are joined...
I think the INNER JOIN node_access should be replaced by node.nid in (SELECT nid from node_access where 'enter all conditions as of now')
What do you think?
Regards,
Luiz
Comments
Comment #1
dawehnerWell this is sort of impossible for views, as views doesn't do anything about node_access. It's all done by core.
Comment #2
linacio CreditAttribution: linacio commentedI think the query is being created by the query function of views_handler_filter_node_access class (inside views/modules/node/views_handler_filter_node_access.inc).
Comment #3
dawehnerCan you export your view? You can add the views_handler_filter_node_access manually but by defaults it's node.module which does all the work.
Comment #4
joseph.olstadif you need role filtering try the views_published_or_roles module for Drupal 7 or Drupal 8
In Drupal 8 you might have to disable aggregation before adding this filter then if you need aggregation, reenable it after adding the filter and configure aggregation again.