Merge pull request #36123 from nextcloud/user-settings-normalize-uid

normalize userid in user:setting
This commit is contained in:
Vincent Petry 2023-01-19 17:45:01 +01:00 committed by GitHub
commit a25645648e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,9 +113,14 @@ class Setting extends Base {
}
protected function checkInput(InputInterface $input) {
$uid = $input->getArgument('uid');
if (!$input->getOption('ignore-missing-user') && !$this->userManager->userExists($uid)) {
throw new \InvalidArgumentException('The user "' . $uid . '" does not exist.');
if (!$input->getOption('ignore-missing-user')) {
$uid = $input->getArgument('uid');
$user = $this->userManager->get($uid);
if (!$user) {
throw new \InvalidArgumentException('The user "' . $uid . '" does not exist.');
}
// normalize uid
$input->setArgument('uid', $user->getUID());
}
if ($input->getArgument('key') === '' && $input->hasParameterOption('--default-value')) {