NodeAccessControlHandler::acquireGrants() does not consider translations with different published states

Created on 3 August 2020, about 5 years ago
Updated 30 January 2023, over 2 years ago

Problem/Motivation

NodeAccessControlHandler::acquireGrants() does not consider translations with different published states. It stores grants for whichever translation you are currently saving and applies it to all translations, regardless of their individual published states.

Steps to reproduce

1. Setup a translatable node type and make sure the published flag is also translatable.
2. Create a node and publish it
3. Create a translation for this node and save it as unpublished.
You can now observer that the original node, which is published, is not accessible.

Proposed resolution

Extend NodeAccessControlHandler::acquireGrants() function to include grants on a per translation basis instead of only the translation being saved.

Remaining tasks

Review attached patch

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

9.5

Component
Node systemΒ  β†’

Last updated about 6 hours ago

No maintainer
Created by

πŸ‡§πŸ‡ͺBelgium weseze

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.

  • The Needs Review Queue Bot β†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

  • Status changed to Needs review 9 months ago
  • πŸ‡ͺπŸ‡ΈSpain dioni

    Hi,

    I had this issue today with drupal 10.3.10, and the patch worked as expected.

    Related patch https://www.drupal.org/project/drupal/issues/3101344#comment-13461721 πŸ› hook_node_grants implementations lead to a 'URL Alias' validation error when saving translated nodes. Fixed has been included in core, so we don't need to apply it.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Patch should be in an MR pointed at 11.x
    As a bug will also need some test coverage.

  • Status changed to Postponed: needs info 5 months ago
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    I am not able to reproduce this issue with the steps provided. Can they be expanded to start from installing Drupal core?

  • πŸ‡§πŸ‡ͺBelgium weseze

    Also can not reproduce this anymore.
    I think it was related to one of the many contribs we are using to provide access controle to nodes. Or it has been fixed in core in another way.

    For anyone interested, in views this is still a problem: https://www.drupal.org/project/drupal/issues/3061782 πŸ“Œ Add langcode from views filter to query metadata Needs work

  • Status changed to Closed: cannot reproduce about 6 hours ago
  • πŸ‡ͺπŸ‡ΈSpain eduardo morales alberti Spain, πŸ‡ͺπŸ‡Ί

    On our case we still need the patch. We have behat coverage and after upgrade to Drupal 11.2.3 the patch #2 did not applied and the multilanguage tests failed because the published states.
    We use the hook node grants to alter those permissions, so it is important for us to respect the translations grants.

Production build 0.71.5 2024