Skip to content

Commit eae1911

Browse files
committed
fix: user:settings command when user is not available
If `ignore-missing-user` all sub commands work, except listing all settings for a user like `occ user:settings --ignore-missing-user user core`. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 6dc83b9 commit eae1911

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/Command/User/Setting.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
213213
return 1;
214214
}
215215
} else {
216+
$ignoreMissingUser = $input->getOption('ignore-missing-user');
216217
$settings = $this->getUserSettings($uid, $app);
217218
$this->writeArrayInOutputFormat($input, $output, $settings);
218219
return 0;
219220
}
220221
}
221222

222-
protected function getUserSettings($uid, $app) {
223+
protected function getUserSettings(string $uid, string $app) {
223224
$settings = $this->config->getAllUserValues($uid);
224225
if ($app !== '') {
225226
if (isset($settings[$app])) {
@@ -230,7 +231,10 @@ protected function getUserSettings($uid, $app) {
230231
}
231232

232233
$user = $this->userManager->get($uid);
233-
$settings['settings']['display_name'] = $user->getDisplayName();
234+
if ($user !== null) {
235+
// Only add the display name if the user exists
236+
$settings['settings']['display_name'] = $user->getDisplayName();
237+
}
234238

235239
return $settings;
236240
}

0 commit comments

Comments
 (0)