Problem/Motivation

Migrate masquerade permissions whose names have changed between D7 and D9(like masquerade as super user).

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

srishti.bankar created an issue. See original summary.

srishtiiee’s picture

Status: Needs work » Needs review
StatusFileSize
new607 bytes
narendrar’s picture

Status: Needs review » Reviewed & tested by the community

Tested manually and masquerade as adminpermission is properly migrated to masquerade as super user.

Masquerade as any user permission is already migrating properly because of same name in D7 & D9.

Other permissions changed between D7/9 and needs to be updated manually.

huzooka’s picture

+++ b/masquerade.module
@@ -244,3 +244,13 @@ function masquerade_switch_user_validate(UserInterface $target_account) {
+function masquerade_migration_plugins_alter(array &$migrations) {
+  $migrations['d7_user_role']['process']['permissions'][0]['map']['masquerade as admin'] = 'masquerade as super user';
+}

I have only a tiny-tiny nit, but I feel it can be important:

Could you please wrap this into a condition which checks/verifies that the first process plugin configuration of the permissions destination property is a static_map plugin?

function masquerade_migration_plugins_alter(array &$migrations) {
  if (
    !empty($migrations['d7_user_role']['process']['permissions'][0]) &&
    $migrations['d7_user_role']['process']['permissions'][0]['plugin'] === 'static_map'
  ) {
    $migrations['d7_user_role']['process']['permissions'][0]['map']['masquerade as admin'] = 'masquerade as super user';
  }
}
srishtiiee’s picture

huzooka’s picture

Assigned: srishtiiee » Unassigned
andypost’s picture

Looks good to be committed but I'm afk next days

  • andypost committed ae9d74f on 8.x-2.x
    Issue #3257969 by srishtiiee: Migrate masquerade permissions from D7 to...
andypost’s picture

Status: Reviewed & tested by the community » Fixed

merged, thanks

Status: Fixed » Closed (fixed)

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