diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-10-17 14:29:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-17 14:29:19 +0200 |
commit | 6375790263c5fadc72e48c9486b06b28d9e805cb (patch) | |
tree | a6022afcb4bf60346e12323927e72b951ee9edd3 | |
parent | c1b2d90ed88a03bcd5ef6cf5eb510d5286196403 (diff) | |
parent | 77a5491d9d18f5dc1a7ea438151292a7472853b3 (diff) | |
download | nextcloud-server-6375790263c5fadc72e48c9486b06b28d9e805cb.tar.gz nextcloud-server-6375790263c5fadc72e48c9486b06b28d9e805cb.zip |
Merge pull request #1766 from nextcloud/force-uid-casing-on-transfer-ownership
Make sure the UID is correctly cased
-rw-r--r-- | apps/files/lib/Command/TransferOwnership.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php index d3994bbdf9f..742948b7ac3 100644 --- a/apps/files/lib/Command/TransferOwnership.php +++ b/apps/files/lib/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,22 @@ 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("<error>Unknown source user $this->sourceUser</error>"); return; } - if (!$this->userManager->userExists($this->destinationUser)) { + + if (!$destination instanceof IUser) { $output->writeln("<error>Unknown destination user $this->destinationUser</error>"); return; } - + + $this->sourceUser = $source->getUID(); + $this->destinationUser = $destination->getUID(); + // target user has to be ready if (!\OC::$server->getEncryptionManager()->isReadyForUser($this->destinationUser)) { $output->writeln("<error>The target user is not ready to accept files. The user has at least to be logged in once.</error>"); |