- Issue created by @dieterholvoet
- 🇧🇪Belgium dieterholvoet Brussels
I'm not sure this circular dependency can be fixed. For now I added this hook to my install profile as a workaround:
/** * Implements hook_ENTITY_TYPE_insert(). * * This is necessary because of a circular dependency between the 'editor' role and the 'assign editor role' permission. * @see https://www.drupal.org/project/role_delegation/issues/3354012 */ function my_install_profile_user_role_insert(RoleInterface $role): void { if ($role->id() === 'editor') { $role->grantPermission('assign editor role'); $role->save(); } }
- 🇧🇪Belgium JeroenT 🇧🇪
This seems as a core bug to me.
I created 🐛 Installation of Drupal fails when having dynamic permissions based on a config entity added during installation Needs work . Let's see what other people think. - 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
One work-around would be enabled by ✨ Create hook_role_delegation_assignable_roles_alter() Needs review .
- 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
I encountered this problem when running functional tests. As part of test setup, it would import the config which include assigning permissions used by
role_delegation
. Since these permissions do not yet exist, it caused an error.I was able to work around it by adding those permissions to a
.permissions.yml
file in a custom module. Now the permissions exist; no error is raised.