I have a private group and as such the group content is also set to be private. In one of the group content types I have an entity reference field that is also set to another group content type (using the inline entity form to create both from one input). When I try to render a view the field with the referenced entity will not appear though access to the entity is still possible by direct entering of the URL.

Also I have a non-group content that is universal in access and also has an entity reference field in it. The referenced entities do not show when viewing the parent node the same as with the group content.

When I disable og_access module this goes away. I'm assuming that the og_access module isn't following through to the referenced entity to check for access and is thus denying it.

Thoughts?

Comments

Cellar Door’s picture

Also when og_access is enabled groups audience entity reference with the entityreference prepopulate doesn't work either.... not sure but it looks like og_access is really throwing off entity reference. Is anyone else running into this with RC3?

freelock’s picture

Hi,

Just responded on IRC, but putting here. You're hitting the scenario we ran across months ago that has led to this:

#1349080: node_access filters out accessible nodes when node is left joined

In short, it's a core bug in node_access, in the way it rewrites all queries tagged with "node access" that use an outer join. The way it rewrites it, it effectively inner joins the node access table each time the node table is in the query -- which is exactly what happens when you use an entity reference relationship in a view.

og_access tags the query for a node_access check, triggering this bug.

I'm working to get this fixed in core, would appreciate any help you can provide there!

You can try applying the latest D7 patch on that thread, #89. That patch is not quite correct -- depending on the query, it might cause a SQL error because of table alias collisions -- but you might not trigger that issue.

Porting the correct patch back to D7 is on my list...

Cellar Door’s picture

The issue is this is happening in non-views as well. Just trying to view the node output doesn't allow for entity referenced nodes to show.

freelock’s picture

Yes, #1349080: node_access filters out accessible nodes when node is left joined should probably get renamed, because it's not a views bug, it's a node_access bug. As mentioned on IRC, any time the node table appears in a query more than once, and there's a left join in between the two tables, node_access will do the wrong thing.

Views with og and entityreference is one case that triggers the bug -- it sounds like you've hit another.

Cellar Door’s picture

Priority: Major » Minor

In the view we were able to get around this via the view relationship. On a normal view output though the relationship still isn't visible. To get around this we are just using views to output the information we need and are architecting around it.

Downgrading to minor for now since it seems like this may not be as big an issue as I had originally thought.