Deleting a workflow can lead to the deletion of unaffected views

Created on 13 December 2023, 7 months ago
Updated 22 January 2024, 5 months ago

Problem/Motivation

Deleting a workflow results in deleting all views sharing the same user role (indirectly, by using per-role permissions).

Steps to reproduce

* Install demo_umami in Drupal 10.1.7
* Delete all content
* Change access of https://example.org/en/admin/structure/views/view/content to role based and select the editor role
* Delete the Editorial workflow https://example.org/en/admin/config/workflow/workflows

-> The view would also be deleted https://example.org/en/admin/structure/views/view/content

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
ConfigurationΒ  β†’

Last updated about 6 hours ago

Created by

πŸ‡©πŸ‡ͺGermany tobiasb Berlin

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

Comments & Activities

  • Issue created by @tobiasb
  • πŸ‡©πŸ‡ͺGermany hexabinaer Berlin, Germany
  • πŸ‡©πŸ‡ͺGermany hexabinaer Berlin, Germany
  • Status changed to Postponed: needs info 7 months ago
  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam
    • Used a clean(ish) Umami install, no contrib installed
    • Added a new workflow
    • Gave the authenticated user permissions for this workflow
    • Added the role based permission for authenticated users to a View
    • Deleted the new Workflow
    • View was still there

    Am I missing steps? Can you reproduce this on a clean Drupal install?

  • Assigned to tobiasb
  • πŸ‡©πŸ‡ͺGermany tobiasb Berlin

    Yes. I did not check this on a clean drupal just on another drupal site and with a custom role.

  • Status changed to Active 7 months ago
  • πŸ‡©πŸ‡ͺGermany tobiasb Berlin

    I retested with demo_umami.

  • Issue was unassigned.
  • πŸ‡©πŸ‡ͺGermany tobiasb Berlin
  • πŸ‡ΊπŸ‡ΈUnited States cilefen

    Are you saying the steps to reproduce require a patch from πŸ› WorkflowDeleteForm should extend EntityDeleteForm Needs work ?

  • πŸ‡©πŸ‡ͺGermany tobiasb Berlin

    No. I just mention the patch so that nobody wonders why looks differently.

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    Yup, the new steps show the problem and the patch certainly helps see it! (strangely enough, it only shows the View getting deleted the second time I try to delete the workflow? Are others seeing that too?)

    A little digging, \Drupal\views\Entity\View::onDependencyRemoval gets called with the editor role dependency, which is not getting removed but edited. But the View reacts to it like it's getting removed, and within the context of \Drupal\views\Entity\View::onDependencyRemoval it is impossible to determine if that dependency gets edited or removed. Since it's called 'onDependencyRemoval' I would assume it is only invoked when things get removed? But not sure.

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    This feels like a configuration management issue from the first little dig I did, so moving it there for now. I don't think Workflows is doing anything wrong, seems more like Views is getting the wrong information, or Views is reaction to the information in the wrong way.

  • πŸ‡©πŸ‡ͺGermany hexabinaer Berlin, Germany

    I would have expected that an affected view would at most react like it would upon a missing field: "missing or broken role".

Production build 0.69.0 2024