Access check should be language dependent

Created on 22 February 2023, over 1 year ago
Updated 5 September 2023, 10 months ago

Problem/Motivation

I'm aware that there are some other issues open about language in the node_access hook but they are not exactly the same.
We have 2 uses cases where it goes wrong. The problem we have is that node_access is called when using Linkit module and also for Entity browser module.

Steps to reproduce

Case 1:

  1. Have the site in English as default language.
  2. Add another language, for example Dutch.
  3. Add a node in Dutch. The node's default language will be NL here. And translate the node in English.
  4. Add a node in English and try to reference the previous English node in a link field with linkit enabled. The node_access hook is triggered and the languages don't match. Current language is EN and node's default language is NL. Maybe the linkit field should pass the translated nodes, could be. but we also face the problems on other cases.

Case 2:

  1. Have the site in English as default language.
  2. Add another language, for example Dutch.
  3. Add a node in Dutch. The node's default language will be NL here. And translate the node in English.
  4. Add a node in English and try to reference the previous English node in an entity reference with an entity browser. The node_access hook is triggered and the languages don't match. Current language is EN and node's default language is NL.

Proposed resolution

Get the translated node, if possible for the current language and get the langcode from there.

Remaining tasks

Create and review patch.

User interface changes

-

API changes

-

Data model changes

-

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇧🇪Belgium tim-diels Belgium 🇧🇪

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024