You are here

protected function UserIntegritySensorPlugin::getUserChanges in Monitoring 8

Gets changes made to user data.

Parameters

array $current_values: Current user data returned by ::processUsers().

array $expected_values: Expected user data returned by ::processUsers().

Return value

string[][] Changes in user.

2 calls to UserIntegritySensorPlugin::getUserChanges()
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 167
Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\UserIntegritySensorPlugin.

Class

UserIntegritySensorPlugin
Monitors user data changes.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

protected function getUserChanges(array $current_values, array $expected_values) {
  $changes = array();
  if ($current_values['name'] != $expected_values['name']) {
    $changes['name']['expected_value'] = $expected_values['name'];
    $changes['name']['current_value'] = $current_values['name'];
  }
  if ($current_values['mail'] != $expected_values['mail']) {
    $changes['mail']['expected_value'] = $expected_values['mail'];
    $changes['mail']['current_value'] = $current_values['mail'];
  }
  if ($current_values['password'] != $expected_values['password']) {
    $changes['password']['expected_value'] = '';
    $changes['password']['current_value'] = t('Password changed');
  }
  return $changes;
}