Problem/Motivation

Given an node is being edited inside workspace, or in other words has an active revision inside a workspace, it is currently still possible to delete it via the delete action on the content overview. Via the delete operations link, this does not work, thus the action shouldn't be allowed to delete a node or any entity that's being inside a workspace either.

Steps to reproduce

On vanilla Drupal 9 or 10

  1. Enable the workspaces module
  2. Create a workspace
  3. Create content in the newly created workspace
  4. Switch back to the LIVE version of the site
  5. Navigate to /admin/content
  6. Check the checkbox on the very left column of the table in the row of the content created above
  7. In the Action dropdown, select Delete content
  8. Click on Apply to selected items and confirm in the next step

Result: Content will get deleted.

Proposed resolution

Implement form altering for the DeleteMultipleForm to make sure, deleting via the action is not possible if

  • The entity can be used aka is supported inside workspaces
  • The entity has an active revision in any workspace

Issue fork wse-3333250

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

s_leu created an issue. See original summary.

s_leu’s picture

Status: Active » Needs review

Looking at this a bit more, it turned out that overriding the DeleteAction plugin was easier than altering the form.

s_leu’s picture

s_leu’s picture

Title: Entities edited in a workspace can be deleted via entity delete action » Entities edited in a workspace can be deleted via bulk operation

amateescu made their first commit to this issue’s fork.

  • amateescu committed 8731a36e on 1.0.x authored by s_leu
    Issue #3333250: Override DeleteAction plugin to extend access() method...
amateescu’s picture

Status: Needs review » Fixed

Merged into 1.0.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.