/** * Prepares extra data to pass to a backend * Those include RUID, EUID, AccountID, environment etc. * * @return array Prepared extra data for logging */ protected function getCommonData() { $data = empty($this->user) ? ["login" => $this->systemTask ? '_' . $this->systemTask : 'guest', "ruid" => null, "euid" => null, "env_id" => $this->envId ?: 0, "account_id" => $this->accountId] : ["login" => $this->user->getEmail(), "ruid" => $this->realUserId ?: $this->user->id, "euid" => $this->user->id, "env_id" => $this->envId ?: 0, "account_id" => empty($this->accountId) ? $this->user->getAccountId() : $this->accountId]; $data['ip_address'] = $this->ipAddress; $data['timestamp'] = AuditLogger::getTimestamp(); $data['request_type'] = $this->requestType; return $data; }
/** * Creates and save Account Team entities with data from fixtures * * @param string $name Account Team data name */ protected function prepareAccountTeam($name) { foreach ($this->sets[$name] as &$accTeamData) { $accTeamData['accountId'] = static::$user->getAccountId(); /* @var $accTeam Account\Team() */ $accTeam = ApiTest::createEntity(new Account\Team(), $accTeamData); $accTeamData['id'] = $accTeam->id; } }
/** * {@inheritdoc} * @see \Scalr\LogCollector\AuditLoggerRetrieveConfigurationInterface::getAuditLoggerConfig() */ public function getAuditLoggerConfig() { $config = new AuditLoggerConfiguration(AuditLogger::REQUEST_TYPE_API); $config->user = $this->user; $config->accountId = $this->user ? $this->user->getAccountId() : null; $config->envId = $this->env ? $this->env->id : null; $config->remoteAddr = $this->request->getIp(); return $config; }