Hook_node_access does not depend on language

Created on 5 April 2019, about 5 years ago
Updated 6 September 2023, 10 months ago

Hello,

Thank you for this module.

I first used it to prevent access of untranslated nodes but my client reported me a bug :
The default language of my site is "FR". If a node is created in "EN" with a private file and not translated in "FR".
The files does not appear on the node and I get access denied on /system/files/file.pdf. Indeed, users don't have access to the node in "FR", so the private file is not accessible.

In a general way, I think the hook_node_access just depends on : operation, node and account. It doesn't take into account a language parameter so that we should not using this hook to restrict access.

Maybe we should add a custom access on the callback of routes 'entity.node.canonical' . That would prevents the access to the page too but in a "less hard way" so that drupal always considers that we have access to the node. (which is the case according to me)

You'll find an archive of the code I made to illustrate, i'm opened to discuss it.

Thanks,

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France Quentin Massez

Live updates comments and jobs are added and updated live.
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.

Production build 0.69.0 2024