You are here

protected function UserIntegritySensorPlugin::processUsers in Monitoring 8

Process user entity into raw value array.

Parameters

\Drupal\user\Entity\User[] $users: Users to process.

Return value

array Processed user data, list of arrays with keys id, name, mail, password ans changed time.

2 calls to UserIntegritySensorPlugin::processUsers()
UserIntegritySensorPlugin::resultVerbose in src/Plugin/monitoring/SensorPlugin/UserIntegritySensorPlugin.php
Provide additional info about sensor call.
UserIntegritySensorPlugin::runSensor in src/Plugin/monitoring/SensorPlugin/UserIntegritySensorPlugin.php
Runs the sensor, updating $sensor_result.

File

src/Plugin/monitoring/SensorPlugin/UserIntegritySensorPlugin.php, line 225
Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\UserIntegritySensorPlugin.

Class

UserIntegritySensorPlugin
Monitors user data changes.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

protected function processUsers(array $users) {
  $processed_users = array();
  foreach ($users as $user) {
    $id = $user
      ->id();
    $processed_users[$id]['id'] = $id;
    $processed_users[$id]['name'] = $user
      ->getAccountName();
    $processed_users[$id]['mail'] = $user
      ->getEmail();
    $processed_users[$id]['password'] = hash('sha256', $user
      ->getPassword());
    $processed_users[$id]['changed'] = $user
      ->getChangedTime();
    $processed_users[$id]['last_accessed'] = $user
      ->getLastAccessedTime();
    $processed_users[$id]['created'] = $user
      ->getCreatedTime();
    $processed_users[$id]['roles'] = implode(", ", $user
      ->getRoles());
  }
  return $processed_users;
}