- ðºðŠ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
almost 2 years 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
almost 2 years 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.
- ðŠðºAustralia acbramley
Updating tags, we'll need some steps to reproduce what sounds like a bug (should this be recategorised from Task?) and test coverage.
- ð§ðªBelgium weseze
Just ran into this "bug".
Both in Drupal 10.4.7 and 11.1.7.I have a view that list the most recent node, filter by published flag and filtered by the content language.
The most recent node is translated, the original language is Dutch, the translation is French. The Dutch language has been unpublished.I have create a page that shows the view, that page is translated.
When viewing the page with the view in French:
as administrator I get the correct French node as most recent.
as anonymous user I do not get the same node, but 1 older. (in French)As both admin an ano user I can directly access the published French translation of that most recent node, so no problem there.
Applying the patch from #30 fixes the issue for us.
We are running several node access related modules, but the only one that actually generates entries in the node_access table is view_unpublished. After removing that module the behaviour did not change.
I also tried removing all modules that do something access related, the behaviour did not change.So for us, this is still a bug and the patch does fix it.
- ðºðžUnited States xjm
This does sound like a bug.
That said, the current patch, which couples the node grant storage to the views API, is a non-starter. I think this would be more properly fixed in the node views handlers somewhere.
- ðºðžUnited States xjm
Setting active and hiding the previous patches since we can't really build on that approach. Thanks!