Editor Role Cannot Publish/Unpublish Without "View Any Unpublished Content" Permission

Created on 2 April 2025, 4 days ago

Problem/Motivation

The PublishContent module allows users to publish and unpublish content. However, there is no built-in permission for "view unpublished content" in this module. As a result, when an Editor role (or any non-admin user) tries to publish or unpublish content, they encounter an "Access Denied" error.

type: 'access denied'
message: 'Path: /training-seminar/mechanical-taping-26. Drupal\Core\Http\Exception\CacheableAccessDeniedHttpException:  
in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 115 of /var/www/docroot/core/lib/Drupal/Core/Routing/AccessAwareRouter.php).'

Steps to reproduce

  1. Install and enable the publishcontent module.
  2. Assign the Editor role the permissions:
  3. publish any content
  4. unpublish any content
  5. Log in as an Editor.
  6. Try to publish or unpublish an unpublished node.
  7. The user receives an "Access Denied" error.

Proposed resolution

  • Add a new permission: "View unpublished content" directly in the PublishContent module.
  • Modify the access checks to allow publishing/unpublishing actions without requiring the Content Moderation module.

Workaround

Currently, one workaround is to enable the core Content Moderation module, which provides the "view any unpublished content" permission. Once assigned to the Editor role, the user is able to see unpublished content and perform publish/unpublish actions.

Feature request
Status

Active

Version

1.7

Component

Code

Created by

🇮🇳India mdeahmad Mumbai

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

Comments & Activities

Production build 0.71.5 2024