Multiple group audience + Views = multiple results

Created on 19 January 2011, almost 14 years ago
Updated 27 October 2024, 2 months ago

I'm pretty sure it's og_access' fault, though it might be faulty Views for all I know.
It also might be a double-post (due to the nature of the beast) but I haven't found any reports about this.

Prequisites:
- a node is assigned to multiple groups
- a user is a member of multiple groups and is not admin (in any context)
- those two sets of groups have a conjunction of size larger than 1 (ie: the user is a member of more than one groups that the node is assigned to)

Real example:
The node is assigned to groups 388 and 367, the user is assigned to groups 402,388,367,387. The below WHERE clause is produced:

[...]
FROM
       (SELECT DISTINCT ON (nid) * FROM node) node 
[...]
	INNER JOIN node_access na ON na.nid = node.nid 
WHERE 
	(
      (
	na.grant_view >= 1 
	AND (
		(na.gid = 0 AND na.realm = 'all') 
		OR (na.gid = 0 AND na.realm = 'og_public') 
		OR (na.gid = 402 AND na.realm = 'og_subscriber') 
		OR (na.gid = 388 AND na.realm = 'og_subscriber') 
		OR (na.gid = 367 AND na.realm = 'og_subscriber') 
		OR (na.gid = 387 AND na.realm = 'og_subscriber')
	))
[...]

When that happens the inner join on "na" causes the whole query to produce multiple results for a particular node. That in conjunction with not selecting any group information for a node in the query will create identical result rows, which in most cases is unwanted (my case in particular).

This will cause multiply display ANYWHERE the node should apper when using views for non-admin users.

Temporary solution:
Hacked the Views code to make a "distinct" filter on all query results.

Real solution:
None imaginable.

🐛 Bug report
Status

Closed: outdated

Version

2.1

Component

og_access.module

Created by

🇵🇱Poland bardzodziwny

Live updates comments and jobs are added and updated live.
  • views

    Involves, uses, or integrates with views. In Drupal 8 core, use the “VDC” tag instead.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇷🇎Romania claudiu.cristea Arad 🇷🇎

    This version of Drupal is not supported anymore. If this is still an issue in the 8.x-1.x branch, please open a new up-to-date ticket. Closing.

Production build 0.71.5 2024