Loading modules/cloud_service_providers/terraform/terraform.module +26 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,32 @@ function terraform_cloud_config_delete(CloudConfig $cloud_config): void { } } /** * Implements hook_ENTITY_TYPE_predelete(). */ function terraform_user_predelete($account): void { /** @var Drupal\cloud\Service\CloudService $cloud_service */ $cloud_service = \Drupal::service('cloud'); $entity_types = $cloud_service->getProviderEntityTypes('terraform'); foreach ($entity_types ?: [] as $entity_type) { if (empty($entity_type)) { continue; } $ids = \Drupal::entityTypeManager() ->getStorage($entity_type->id()) ->getQuery() ->accessCheck(TRUE) ->condition('uid', $account->id()) ->execute(); if (count($ids) === 0) { continue; } $cloud_service->reassignUids($ids, [ 'uid' => 0, ], $entity_type->id(), FALSE, $account); } } /** * Get fieldsets of cloud config page. * Loading Loading
modules/cloud_service_providers/terraform/terraform.module +26 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,32 @@ function terraform_cloud_config_delete(CloudConfig $cloud_config): void { } } /** * Implements hook_ENTITY_TYPE_predelete(). */ function terraform_user_predelete($account): void { /** @var Drupal\cloud\Service\CloudService $cloud_service */ $cloud_service = \Drupal::service('cloud'); $entity_types = $cloud_service->getProviderEntityTypes('terraform'); foreach ($entity_types ?: [] as $entity_type) { if (empty($entity_type)) { continue; } $ids = \Drupal::entityTypeManager() ->getStorage($entity_type->id()) ->getQuery() ->accessCheck(TRUE) ->condition('uid', $account->id()) ->execute(); if (count($ids) === 0) { continue; } $cloud_service->reassignUids($ids, [ 'uid' => 0, ], $entity_type->id(), FALSE, $account); } } /** * Get fieldsets of cloud config page. * Loading