"Adding non-existent permissions to a role is not allowed." error

Created on 3 January 2025, 5 days ago

Upgraded to 3.0.0 on D10.4.0 and on running database updates I got

RuntimeException: Adding non-existent permissions to a role is not allowed. The incorrect permissions are "delete files". in Drupal\user\Entity\Role->calculateDependencies() (line 216 of core\modules\user\src\Entity\Role.php).

Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object) (Line: 183)
Drupal\user\Entity\Role->preSave(Object) (Line: 528)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 483)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 257)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 617)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 1010)
user_role_grant_permissions('admi', Array) (Line: 984)
user_role_change_permissions('admi', Array) (Line: 257)
Drupal\user\Form\UserPermissionsForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('user_admin_permissions', Array, Object) (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

According to this πŸ› "Adding non-existent permissions to a role is not allowed." exception is thrown for profile installations Needs work , β€œThe module that defines the permission is responsible for defining the dependencies.” I tried the patch β†’ there, but it didn’t help.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡­πŸ‡ΊHungary Grabby

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

Merge Requests

Comments & Activities

  • Issue created by @Grabby
  • πŸ‡³πŸ‡±Netherlands arantxio Dordrecht

    I am also experiencing this issue at the moment, i think the check needs to be changed to "delete any file" instead of "delete files", as it seems this permission doesn't exist. But since we already check for "delete own files" and "delete any files" it can be dropped in general

  • Pipeline finished with Success
    2 days ago
    Total: 153s
    #387419
  • πŸ‡³πŸ‡±Netherlands arantxio Dordrecht

    I've created the above merge request, it worked for me on the first time, but I tried it again and now it doesn't seem to work, so ill have to adjust something first.

  • Pipeline finished with Success
    2 days ago
    Total: 143s
    #387442
  • πŸ‡³πŸ‡±Netherlands arantxio Dordrecht

    I have updated the code to fix the error the problem is the previous code checks for the permission "delete file" but this permission didn't exist, it used to be "delete files" which is the permission its missing because it got removed in the upgrade to 3.0

    The merge request fixes the "file_delete_update_400002" update hook to look for the other permission.

    This solves the upgrade problem I had.

  • πŸ‡³πŸ‡±Netherlands arantxio Dordrecht
Production build 0.71.5 2024