From 6902fb578f8674885f45a7dbab924380d451a5d3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 17 Oct 2016 14:38:13 +0200 Subject: Make sure the UID is correctly cased Signed-off-by: Joas Schilling --- apps/files/command/transferownership.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/files/command/transferownership.php b/apps/files/command/transferownership.php index d3994bbdf9f..96ed8fbbb84 100644 --- a/apps/files/command/transferownership.php +++ b/apps/files/command/transferownership.php @@ -28,6 +28,7 @@ use OC\Files\Filesystem; use OC\Files\View; use OCP\Files\FileInfo; use OCP\Files\Mount\IMountManager; +use OCP\IUser; use OCP\IUserManager; use OCP\Share\IManager; use OCP\Share\IShare; @@ -92,15 +93,21 @@ class TransferOwnership extends Command { protected function execute(InputInterface $input, OutputInterface $output) { $this->sourceUser = $input->getArgument('source-user'); $this->destinationUser = $input->getArgument('destination-user'); - if (!$this->userManager->userExists($this->sourceUser)) { + $source = $this->userManager->get($this->sourceUser); + $destination = $this->userManager->get($this->destinationUser); + + if (!$source instanceof IUser) { $output->writeln("Unknown source user $this->sourceUser"); return; } - if (!$this->userManager->userExists($this->destinationUser)) { + if (!$destination instanceof IUser) { $output->writeln("Unknown destination user $this->destinationUser"); return; } - + + $this->sourceUser = $source->getUID(); + $this->destinationUser = $destination->getUID(); + // target user has to be ready if (!\OC::$server->getEncryptionManager()->isReadyForUser($this->destinationUser)) { $output->writeln("The target user is not ready to accept files. The user has at least to be logged in once."); -- cgit v1.2.3 From e12e27fa65953e96eb3bb66981eb8b201c7a064d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 21 Oct 2016 11:25:22 +0200 Subject: Fix issues where some user settings cannot be loaded when the user id differs in case sensitivity Signed-off-by: Joas Schilling --- lib/private/user/manager.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php index eb86873a26f..e638823ad29 100644 --- a/lib/private/user/manager.php +++ b/lib/private/user/manager.php @@ -155,6 +155,16 @@ class Manager extends PublicEmitter implements IUserManager { return $this->cachedUsers[$uid]; } + if (method_exists($backend, 'loginName2UserName')) { + $loginName = $backend->loginName2UserName($uid); + if ($loginName !== false) { + $uid = $loginName; + } + if (isset($this->cachedUsers[$uid])) { + return $this->cachedUsers[$uid]; + } + } + $user = new User($uid, $backend, $this, $this->config); if ($cacheUser) { $this->cachedUsers[$uid] = $user; -- cgit v1.2.3