Problem/Motivation

When using Group with Content Moderation, the Access Unpublished tokens don't work for granting access to the /group/#/latest route (i.e., a new draft of an already published group).

Normally, AU supports the /latest route on moderated entities just fine. Access to that route is controlled by '_content_moderation_latest_version', which is handled by the 'access_check.latest_revision' service. AU decorates that service with its own 'access_unpublished.access_check.latest_revision' service to provide the token logic.

However, for Group entities, GroupLatestRevisionRouteSubscriber removes '_content_moderation_latest_version' and replaces it with its own '_group_latest_revision' access handler, implemented by the 'access_check.group_latest_revision' service. Thus, AU's decorator never comes into play.

Steps to reproduce

  1. Install Content Moderation, Group, Access Unpublished, and Access Unpublished Group.
  2. Set up a group type and permissions, etc. as normal for AU/AUG.
  3. Configure the group type to use the Editorial workflow.
  4. Create a group and save it as published.
  5. Edit the group and save your changes as a draft.
  6. Edit the group again and create an AU token.
  7. Copy the token, then paste it into the URL of an anonymous browser session.

Expected result: The group page loads for the anonymous user with the tokenized URL. Removing the token from the URL yields Access Denied.
Actual result: The anonymous user gets Access Denied even with the tokenized URL.

Proposed resolution

We can fix this by decorating the 'access_check.group_latest_revision' service to add token handling.

API changes

Adds an 'access_unpublished.access_check.group_latest_revision' service that decorates 'access_check.group_latest_revision'.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

muriqui created an issue. See original summary.

nickolaj’s picture

Status: Active » Needs review

Decorates the `access_check.group_latest_revision` service to add Access Unpublished token support for `/group/{group}/latest` routes.

muriqui’s picture

Status: Needs review » Reviewed & tested by the community

Tested and confirmed: the MR resolves the issue. Thanks!

dmundra’s picture

Thank you @muriqui and @nickolaj. It would be great to add a test for this and I believe @muriqui will be working on one.

dmundra’s picture

Status: Reviewed & tested by the community » Fixed

Thank you @muriqui. Merging the changes.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • dmundra committed aed0e992 on 2.x authored by nickolaj
    Issue #3569298: Decorates the `access_check.group_latest_revision`...
    
dmundra’s picture

Status: Fixed » Closed (fixed)