Add support for 'view own unpublished entity' permission

Created on 8 May 2017, over 7 years ago
Updated 26 May 2023, over 1 year ago

Problem/Motivation

The Group content permission provider does not provide a 'view own unpublished entity' permission. This permission is particularly useful for the content moderation module. When content has to be reviewed before publishing you want the ability for the group member and creator of the content item to edit the content item. Right now the only way would be to add the "View any unpublished entity" permission to all group members which is not acceptable for most common use cases.

Proposed resolution

Add that permission in the GroupContentPermissionProvider for entities which implement the PublishedInterface and OwnerInterface.

The access check is already done in Drupal\group\Plugin\GroupContentAccessControlHandler by checking for the "view own unpublished entity".

There is already a test for the Entity Query Access in EntityQueryAlterComplexTest::testMemberViewOwnUnpublishedAccess so we won't need to test for that.

Tests need to be changed in:

  • GroupContentPermissionProvider: to make sure the correct permissions are provided based on the implementation of PublishedInterface and OwnerInterface
  • EntityAccessComplexTest: to make sure that the user can view it's own unpublished content when it has the permission
✨ Feature request
Status

Fixed

Version

3.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jhedstrom Portland, OR

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.71.5 2024