瀏覽代碼

normalize userid in user:setting

Signed-off-by: Robin Appelman <robin@icewind.nl>
Robin Appelman 1 年之前
父節點
當前提交
975becb22e
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8 3
      core/Command/User/Setting.php

+ 8 - 3
core/Command/User/Setting.php

@@ -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')) {