Skip to content

Commit 5867231

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 5867231

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/Command/User/Setting.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
219219
}
220220
}
221221

222-
protected function getUserSettings($uid, $app) {
222+
protected function getUserSettings(string $uid, string $app): array {
223223
$settings = $this->config->getAllUserValues($uid);
224224
if ($app !== '') {
225225
if (isset($settings[$app])) {
@@ -230,7 +230,10 @@ protected function getUserSettings($uid, $app) {
230230
}
231231

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

235238
return $settings;
236239
}

0 commit comments

Comments
 (0)