diff -u b/src/Plugin/monitoring/SensorPlugin/UserIntegritySensorPlugin.php b/src/Plugin/monitoring/SensorPlugin/UserIntegritySensorPlugin.php --- b/src/Plugin/monitoring/SensorPlugin/UserIntegritySensorPlugin.php +++ b/src/Plugin/monitoring/SensorPlugin/UserIntegritySensorPlugin.php @@ -213,10 +213,7 @@ // Create rows for old users. foreach ($old_user_ids as $id) { - $changes = []; - if (isset($current_users[$id])) { - $changes = $this->getUserChanges($current_users[$id], $expected_users[$id]); - } + $changes = $this->getUserChanges($current_users[$id], $expected_users[$id]); foreach ($changes as $key => $value) { $time_stamp = $current_users[$id]['changed']; $user_name = array( @@ -296,7 +293,10 @@ $old_user_ids = array_keys($expected_users); foreach ($old_user_ids as $id) { - $changes = $this->getUserChanges($current_users[$id], $expected_users[$id]); + $changes = []; + if (isset($current_users[$id])) { + $changes = $this->getUserChanges($current_users[$id], $expected_users[$id]); + } foreach ($changes as $key => $value) { $time_stamp = $current_users[$id]['changed']; $last_accessed = $current_users[$id]['last_accessed']; @@ -368,6 +368,41 @@ ) + $rows; } + // Verbose output for deleted users. + $rows = []; + $deleted_users = db_select('watchdog') + ->fields('watchdog') + ->condition('type', 'user') + ->condition('message', "Deleted %", 'LIKE') + ->orderBy('wid', 'DESC') + ->execute() + ->fetchAll(); + + foreach ($deleted_users as $user) { + $variables = unserialize($user->variables); + $rows[] = [ + 'wid' => ['#markup' => $user->wid], + 'user' => ['#markup' => $variables['%name']], + 'deleted' => ['#markup' => date("Y-m-d H:i:s", $user->timestamp)], + ]; + } + + if (count($rows) > 0) { + $output['message_deleted'] = array( + '#type' => 'item', + '#title' => t('All deleted users.'), + ); + $header = [ + 'wid' => t('WID'), + 'user' => t('User'), + 'deleted' => t('Deleted date'), + ]; + $output['deleted_users'] = array( + '#type' => 'table', + '#header' => $header, + ) + $rows; + } + // Show roles list with the permissions that are restricted for each. $roles_list = []; foreach (Role::loadMultiple($role_ids) as $role) {