You are here

public function AcsfDuplicationScrubEntityHandler::getSiteAdmins in Acquia Cloud Site Factory Connector 8.2

Same name and namespace in other branches
  1. 8 src/Event/AcsfDuplicationScrubEntityHandler.php \Drupal\acsf\Event\AcsfDuplicationScrubEntityHandler::getSiteAdmins()

Gets a list of site admins.

Return value

array An indexed array of user IDs representing site admins.

1 call to AcsfDuplicationScrubEntityHandler::getSiteAdmins()
AcsfDuplicationScrubEntityHandler::getPreservedUsers in src/Event/AcsfDuplicationScrubEntityHandler.php
Gets a list of user IDs which should not be scrubbed.

File

src/Event/AcsfDuplicationScrubEntityHandler.php, line 188

Class

AcsfDuplicationScrubEntityHandler
Handles the scrubbing of Drupal entities.

Namespace

Drupal\acsf\Event

Code

public function getSiteAdmins() {
  $uids = [];
  $admin_roles = $this->entityTypeManager
    ->getStorage('user_role')
    ->getQuery()
    ->condition('is_admin', TRUE)
    ->execute();
  $this->moduleHandler
    ->alter('acsf_duplication_scrub_admin_roles', $admin_roles);
  if (!empty($admin_roles)) {
    $uids = $this->entityTypeManager
      ->getStorage('user')
      ->getQuery()
      ->condition('roles', $admin_roles, 'IN')
      ->execute();
  }
  return $uids;
}