Problem/Motivation

When installing a site from existing configuration (e.g., via configuration sync or a distribution), roles with form_mode_control permissions (e.g., "Use the form mode X linked to node entity Y") trigger errors like:

Non-existent permission(s) assigned to role "editor" (editor) were removed. Invalid permission(s): use The form mode my_form_mode linked to node entity( article ).

This happens because those dynamically-generated permissions are missing proper dependencies on their associated core.entity_form_display configs. As a result, if the form display config isn't present, due to config import order for example, Drupal can't cleanly manage the permission.

Steps to reproduce

  1. Install form_mode_control module and create custom form modes.
  2. Assign the generated form mode permissions to a role.
  3. Export config.
  4. Import config in a clean install.
  5. Observe warnings about invalid permissions removed from roles.

Proposed resolution

  1. Add a 'dependencies' => ['config' => ['core.entity_form_display.X.Y.Z']] entry for each form mode permission in roleToFormMode().
  2. Provide a hook_update_N() implementation to trigger recalculating role config dependencies for existing sites.
CommentFileSizeAuthor
#3 3524072.patch1.4 KBredwan jamous
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

redwan jamous created an issue. See original summary.

redwan jamous’s picture

StatusFileSize
new1.4 KB

Attaching static patch file to use with composer...

redwan jamous’s picture

Assigned: redwan jamous » Unassigned
Status: Active » Needs review

dieterholvoet made their first commit to this issue’s fork.

dieterholvoet’s picture

dieterholvoet’s picture

Status: Needs review » Fixed

Thanks for your contribution!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.