You are here

function default_content_deploy_update_8001 in Default Content Deploy 8

Swap permission 'import content' for 'default content deploy import'.

File

./default_content_deploy.install, line 11
Install, update and uninstall hooks for default_content_deploy module.

Code

function default_content_deploy_update_8001() {

  /** @var \Drupal\user\Entity\Role[] $roles */
  $roles = \Drupal::entityTypeManager()
    ->getStorage('user_role')
    ->loadMultiple();
  foreach ($roles as $role) {
    if ($role
      ->hasPermission('import content')) {
      $role
        ->revokePermission('import content')
        ->grantPermission('default content deploy import')
        ->save();
    }
  }
}