Problem/Motivation

In #3083615: Check if scheduled transitions are valid for editing user, a feature was introduced which denies users access to editing nodes that are scheduled to a transition they don't have access to.
While this is the right way to do in most cases, there might be situations where this behavior is not desired.

Steps to reproduce

In our case, we have a Person node type, which represents employees of a company. Some of them might have fixed-term contracts, so we use the Scheduler module to make sure they get unpublished automatically when the contract ends. We're also using Content Moderation with a pretty much default setup with an Editor role that is not allowed to publish or archive.

  • Image we're hiring a new employee with a 2-year contract. So we create a new Person node with a scheduled unpublication date of "today + 2 years".
  • During that 2-year period, editors might need to change some information, but they can't, due to the fact that they don't have permission to unpublish the node.

In this scenario, it feels wrong to deny access to editors. They should be able to create new drafts, which may be published by users with the appropriate permission, until finally the node gets unpublished automatically when the 2-year period is over.

Proposed resolution

Allow admins to opt in or out to this behavior through a configuration setting. Perhaps it's even necessary to do this on a per-bundle basis.

Remaining tasks

User interface changes

API changes

Data model changes

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

mrshowerman created an issue. See original summary.

mrshowerman’s picture

Here's a patch that simply removes the access check. This is of course not the solution, but it might be handy for others who have the same scenario.

jonathan1055’s picture

Hi @mrshowerman,
Yes I think you have a valid use case for wanting to allow the Editor to make changes, in preparation for an authorised user (let's call them the Manager) to make it current. As an alternative to making the access check a configurable option, maybe there is a way to let the Editor update the content but not have access to alter the scheduling date or scheduled state. They would make a new draft of the content, and the Manager could then edit, make it 'published' manually (to replace the existing published content) and set the unpublish date and state. There might even be a way to automatically extract the existing unpublish date and state, so that the Manager does not have to re-do it.

Some ideas to think on ...

mrshowerman’s picture

Strangely enough, this seems already be the case in our setup with above patch: Person entities get created by a Manager, including a scheduled unpublish date. Editors can create new drafts, which can be published by the Manager. But all these changes don't affect the scheduled unpublish date; it keeps the value that was set initially.

I understand that the motivation for introducing the access check in #3083615: Check if scheduled transitions are valid for editing user was to avoid unwanted changes to the scheduled states when a node is updated by someone with just Editor permissions, but so far I failed to reproduce such a behaviour, even after having removed the access check.

smustgrave’s picture

Version: 8.x-1.x-dev » 2.x-dev

I like the idea of a simple setting. Or maybe a permission to "bypass SCMI access" to be applied to roles. Thoughts?

jonathan1055’s picture

Version: 2.x-dev » 3.0.x-dev

New features will first be done in the 3.x branch.

mrshowerman’s picture

Status: Active » Needs review

Created an MR which adds a permission to bypass the access check.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Can we get a test for this new feature.

bkosborne’s picture

Title: Make transition check configurable » Make transition check configurable; allow users to without access to scheduled state to continue editing entity