diff --git a/library/Director/Core/CoreApi.php b/library/Director/Core/CoreApi.php index 88a2c7c68..383075ceb 100644 --- a/library/Director/Core/CoreApi.php +++ b/library/Director/Core/CoreApi.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Director\Core; use Exception; +use Icinga\Authentication\Auth; use Icinga\Exception\NotFoundError; use Icinga\Module\Director\Db; use Icinga\Module\Director\Hook\DeploymentHook; @@ -834,6 +835,11 @@ public function dumpConfig(IcingaConfig $config, Db $db, $packageName = null) if ($packageName === null) { $packageName = $db->settings()->get('icinga_package_name'); } + $username = null; + $auth = Auth::getInstance(); + if ($auth->isAuthenticated()) { + $username = $auth->getUser()->getUsername(); + } $start = microtime(true); /** @var DirectorDeploymentLog $deployment */ $deployment = DirectorDeploymentLog::create(array( @@ -842,9 +848,9 @@ public function dumpConfig(IcingaConfig $config, Db $db, $packageName = null) 'peer_identity' => $this->client->getPeerIdentity(), 'start_time' => date('Y-m-d H:i:s'), 'config_checksum' => $config->getChecksum(), - 'last_activity_checksum' => $config->getLastActivityChecksum() + 'last_activity_checksum' => $config->getLastActivityChecksum(), + 'username' => $username // 'triggered_by' => Util::getUsername(), - // 'username' => Util::getUsername(), // 'module_name' => $moduleName, )); diff --git a/library/Director/Web/Widget/DeploymentInfo.php b/library/Director/Web/Widget/DeploymentInfo.php index 1f87abcd8..3b78c5419 100644 --- a/library/Director/Web/Widget/DeploymentInfo.php +++ b/library/Director/Web/Widget/DeploymentInfo.php @@ -78,6 +78,7 @@ protected function createInfoTable() $table->addNameValuePairs([ $this->translate('Deployment time') => $dep->start_time, $this->translate('Sent to') => $dep->peer_identity, + $this->translate('Triggered by') => $dep->username, ]); if ($this->config !== null) { $table->addNameValuePairs([