chg: [audit logs] fix test
parent
8cf325d263
commit
23c41008d4
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue