new: [CLI] Assign UserSetting to list output

pull/7730/head
Jakub Onderka 2021-09-06 13:28:48 +02:00
parent 2ed41a0964
commit 3773fdff93
2 changed files with 24 additions and 21 deletions

View File

@ -82,28 +82,31 @@ class UserShell extends AppShell
public function list()
{
// do not fetch sensitive or big values
$schema = $this->User->schema();
unset($schema['authkey']);
unset($schema['password']);
unset($schema['gpgkey']);
unset($schema['certif_public']);
$fields = array_keys($schema);
$fields[] = 'Role.*';
$fields[] = 'Organisation.*';
$users = $this->User->find('all', [
'recursive' => -1,
'fields' => $fields,
'contain' => ['Organisation', 'Role'],
]);
if ($this->params['json']) {
// do not fetch sensitive or big values
$schema = $this->User->schema();
unset($schema['authkey']);
unset($schema['password']);
unset($schema['gpgkey']);
unset($schema['certif_public']);
$fields = array_keys($schema);
$fields[] = 'Role.*';
$fields[] = 'Organisation.*';
$users = $this->User->find('all', [
'recursive' => -1,
'fields' => $fields,
'contain' => ['Organisation', 'Role', 'UserSetting'],
]);
$this->out($this->json($users));
} else {
$users = $this->User->find('column', [
'fields' => ['email'],
]);
foreach ($users as $user) {
$this->out($user['User']['email']);
$this->out($user);
}
}
}

View File

@ -231,7 +231,7 @@ class OidcAuthenticate extends BaseAuthenticate
/**
* @param int $userId
* @param array $verifiedClaims
* @param stdClass $verifiedClaims
* @return array|bool|mixed|null
* @throws Exception
*/
@ -239,8 +239,8 @@ class OidcAuthenticate extends BaseAuthenticate
{
$value = [];
foreach (['sub', 'preferred_username', 'given_name', 'family_name'] as $field) {
if (isset($verifiedClaims[$field])) {
$value[$field] = $verifiedClaims[$field];
if (property_exists($verifiedClaims, $field)) {
$value[$field] = $verifiedClaims->{$field};
}
}