aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-09-11 11:26:59 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2025-01-27 20:51:04 +0100
commit5867231247d240f51efbe00f32f963a957373c46 (patch)
treee8d9795e014b2bd58162c54f2fc92366a1bf4cc3 /core
parent6dc83b96c40d094ccb3a8b8dfa74fec263e2852d (diff)
downloadnextcloud-server-5867231247d240f51efbe00f32f963a957373c46.tar.gz
nextcloud-server-5867231247d240f51efbe00f32f963a957373c46.zip
fix: `user:settings` command when user is not availablefix/settings-command
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>
Diffstat (limited to 'core')
-rw-r--r--core/Command/User/Setting.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/Command/User/Setting.php b/core/Command/User/Setting.php
index e2e65f7d5f9..16e851d8252 100644
--- a/core/Command/User/Setting.php
+++ b/core/Command/User/Setting.php
@@ -219,7 +219,7 @@ class Setting extends Base {
}
}
- protected function getUserSettings($uid, $app) {
+ protected function getUserSettings(string $uid, string $app): array {
$settings = $this->config->getAllUserValues($uid);
if ($app !== '') {
if (isset($settings[$app])) {
@@ -230,7 +230,10 @@ class Setting extends Base {
}
$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;
}