Skip to content

Commit

Permalink
fix: user:settings command when user is not available
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
susnux committed Jan 27, 2025
1 parent 6dc83b9 commit eae1911
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/Command/User/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 1;
}
} else {
$ignoreMissingUser = $input->getOption('ignore-missing-user');
$settings = $this->getUserSettings($uid, $app);
$this->writeArrayInOutputFormat($input, $output, $settings);
return 0;
}
}

protected function getUserSettings($uid, $app) {
protected function getUserSettings(string $uid, string $app) {
$settings = $this->config->getAllUserValues($uid);
if ($app !== '') {
if (isset($settings[$app])) {
Expand All @@ -230,7 +231,10 @@ protected function getUserSettings($uid, $app) {
}

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

return $settings;
}
Expand Down

0 comments on commit eae1911

Please sign in to comment.