chg: [audit logs] fix test

pull/101/head
iglocska 2022-05-17 09:23:08 +02:00
parent 8cf325d263
commit 23c41008d4
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 10 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class AuditLogsTable extends AppTable
}
$defaults = [
'user_id' => 0,
'request_type' => 'CLI',
'request_type' => self::REQUEST_TYPE_CLI,
'authkey_id' => 0
];
foreach (array_keys($defaults) as $field) {
@ -194,6 +194,15 @@ class AuditLogsTable extends AppTable
if (isset($authUser['authkey_id'])) {
$this->user['authkey_id'] = $authUser['authkey_id'];
}
} else {
$this->user['request_type'] = self::REQUEST_TYPE_CLI;
$currentUserId = Configure::read('CurrentUserId');
if (!empty($currentUserId)) {
$this->user['id'] = $currentUserId;
$userFromDb = $this->Users->find()->where(['id' => $currentUserId])->first();
$this->user['name'] = $userFromDb['name'];
$this->user['org_id'] = $userFromDb['org_id'];
}
}
}
return $this->user;