- ðºðŠUkraine Skymen
Problem still present on Drupal 10.1.0 with Domain â 2.0.0-beta1 module. I've tested patch #14 and it works for me.
- last update
over 1 year ago Patch Failed to Apply Ploblem still present on D10.1.1 with views_unpublish module.
I create a patch for D10.1.1- last update
over 1 year ago 29,459 pass - ð«ð®Finland vermario
We encountered this same issue in the context of the module we are developing https://www.drupal.org/project/access_by_taxonomy â
Our module adds grants that are based on the taxonomy terms added to a node (can be role or specific user). We add these grants also based on translation.
The case where we see a problem in views (Compared to the actual access of the node when trying to visit it directly is this):
1. we add a node with some restrictions, saying that it should be visible for a given user role, set the node as unpublished
2. we add a translation to the node, publish the translationNow, all users of the role that is specified for access should see the node in views: in this case they should not see the original version, but they should see the translation.
When doing an entity query or a view, the translation is not returned, because the table is checked with fallback = 1
This is an example of the query:
SELECT "node_field_data"."created" AS "node_field_data_created", "node_field_data"."nid" AS "nid", "node_field_data"."langcode" AS "node_field_data_langcode" FROM {node_field_data} "node_field_data" WHERE (("node_field_data"."type" IN ('article')) AND ("node_field_data"."langcode" IN ('it'))) AND (EXISTS (SELECT "na"."nid" AS "nid" FROM {node_access} "na" WHERE ((("gid" IN ('0')) AND ("realm" = 'all')) OR (("gid" IN ('2', '3')) AND ("realm" = 'access_by_taxonomy_role')) OR (("gid" IN ('4')) AND ("realm" = 'access_by_taxonomy_user')) OR (("gid" IN ('4')) AND ("realm" = 'access_by_taxonomy_own_unpublished')) OR (("gid" IN ('4')) AND ("realm" = 'access_by_taxonomy_owner'))) AND ("na"."grant_view" >= '1') AND ("na"."fallback" = '1') AND (([node_field_data].[nid] = [na].[nid])))) ORDER BY "node_field_data_created" DESC LIMIT 11 OFFSET 0
The node_access table looks like this:
10,en,1,1,access_by_taxonomy_view_any_article,1,0,0 10,it,0,1,access_by_taxonomy_view_any_article,1,0,0 10,en,1,3,access_by_taxonomy_owner,1,0,0 10,it,0,3,access_by_taxonomy_owner,1,0,0 10,en,1,3,access_by_taxonomy_own_unpublished,1,0,0 10,it,0,3,access_by_taxonomy_role,1,0,0
So there is no row with fallback = 1 that grants access, so the italian translation of the node is not shown in the view, even though the user would have access to it.
Adding the patch has the opposite effect, both the unpublished node and the translation show up in the view, which is also what we don't wat.
I wonder if we have found a corner case of the node_access system...
- ð§ðªBelgium jurgenr
This patch causes issues on 10.3.*, due to the changes done in issue https://www.drupal.org/project/drupal/issues/1349080 ð node_access filters out accessible nodes when node is left joined Needs work .
Is this patch still necessary? I'm pretty sure it is still needed as I had to reroll it and use it - altough I'm using my own slightly expanded version of this https://git.drupalcode.org/project/drupal/-/merge_requests/1934/diffs which also covers relationships (I think, it was long time ago)... maybe the basic issue is resolved, I may test it some day.
Meanwhile, here is the patch I'm using with 10.3 (no guarantees, it simply works for me) if anyone wants to try it.