fix: [user] Include user settings in /users/view

pull/5317/head
iglocska 2019-10-15 07:24:43 +02:00
parent 907daf8723
commit 6d8b76ae4f
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 14 additions and 1 deletions

View File

@ -609,7 +609,19 @@ class User extends AppModel
throw new NotFoundException('Invalid user ID.');
}
$conditions = array('User.id' => $id);
$user = $this->find('first', array('conditions' => $conditions, 'recursive' => -1,'contain' => array('Organisation', 'Role', 'Server')));
$user = $this->find(
'first',
array(
'conditions' => $conditions,
'recursive' => -1,
'contain' => array(
'Organisation',
'Role',
'Server',
'UserSetting'
)
)
);
if (empty($user)) {
return $user;
}
@ -617,6 +629,7 @@ class User extends AppModel
$user['User']['Role'] = $user['Role'];
$user['User']['Organisation'] = $user['Organisation'];
$user['User']['Server'] = $user['Server'];
$user['User']['UserSetting'] = $user['UserSetting'];
unset($user['Organisation'], $user['Role'], $user['Server']);
return $user['User'];
}