Upgrade to 2.x can result in orphan permissions and D10 upgrade warning

Created on 21 September 2023, over 1 year ago

Problem/Motivation

When upgrading from the 1.x branch to 2.x on Drupal 9, the permission "edit layout paragraphs plugin config" may not be removed cleanly. As a result, Upgrade Status will display a warning that " Invalid permissions will trigger runtime exceptions in Drupal 10 β†’ . Permissions should be defined in a permissions.yml file or a permission callback." for the orphaned permissions left in config.

It is possible that enabling the new Layout Paragraphs Permissions module when upgrading to 2.x resolves this problem, but in our case we found we did not need it: we already have Field Permissions module managing access to the Layout Paragraphs UI. But the permission that was present in the 1.x version had been set on our site before the upgrade (even if it may not have been necessary), and after the upgrade, it remained in configuration in an orphan state. This lead to the alert from Upgrade Status module.

I'm not sure if this is something that requires a fix, but I figured I'd submit this ticket for anyone else who is upgrading this module in preparation for Drupal 10 and runs into the same issue.

Steps to reproduce

  • Start with a site running the 1.x branch of Layout Paragraphs.
  • Set the "edit layout paragraphs plugin config" permission for at least one role.
  • Upgrade to the latest 2.x branch (but do not enable the new Layout Paragraphs Permissions submodule).
  • Enable Upgrade Status module and review the "Drupal core and hosting environment" requirements at the top.

Proposed resolution

There should probably be an update script to check for orphan permissions on the 2.x branch and remove them if present. This might be complicated if the new Layout Paragraphs Permissions submodule checks for such permissions and transfers them to the new submodule: you wouldn't want to remove the permissions if they're needed later.

Other solutions that don't require updating Layout Paragraphs:

  • Remove the permissions from all roles on the site while still on the 1.x branch, prior to upgrading.
  • Manually update config files to remove orphan permissions & run config import. (Note that each permission file needs to have Layout Paragraphs removed from the module dependencies as well as the permission itself, since there are no other permissions for Layout Paragraphs.
  • See also the link in the Upgrade Status report to the change record β†’ that introduces this permissions requirement. There are additional solutions for removing orphaned permissions in general in the comments.
πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States daletrexel Minnesota, USA

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

Comments & Activities

Production build 0.71.5 2024