RuntimeException: Adding non-existent permissions to a role is not allowed.

Created on 7 December 2023, about 1 year ago

Problem/Motivation

Permissions granted for a given menu are not removed when that menu is deleted. On Drupal 10.1 at least, when dependencies are calculated (e.g. editing/saving a field), this will result in:

RuntimeException: Adding non-existent permissions to a role is not allowed. The incorrect permissions are "administer menu-site-utrc menu items". in Drupal\user\Entity\Role->calculateDependencies() (line 207 of core/modules/user/src/Entity/Role.php).

Full trace attached β†’ .

Steps to reproduce

  1. Create a menu -- let's call it "Test Menu".
  2. Assign the "Administer Test Menu menu items" to at least one role.
  3. Delete Test Menu.
  4. Visit "Manage fields" for any Content Type and edit any standard field.
  5. Click "Save settings" (you don't have to change anything).
  6. Behold the error.

Proposed resolution

Update the module to define dependencies for the generated permissions per this change record β†’ .

Here's the similar issue πŸ› RuntimeException: Adding non-existent permissions to a role is not allowed. Needs review in Field Permissions (which also defines custom permissions), with the discussion of a likely solution beginning at #17 πŸ› RuntimeException: Adding non-existent permissions to a role is not allowed. Needs review .

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States justcaldwell Austin, Texas

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024