summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-10-17 11:42:54 +0200
committerJoas Schilling <coding@schilljs.com>2016-10-17 13:41:38 +0200
commit77a5491d9d18f5dc1a7ea438151292a7472853b3 (patch)
tree1bd73db68949ff8094640e7d29b1ec244cf2fb82 /apps/files
parent96f8f209b9e899207a338eaa69b439e55f749ed5 (diff)
downloadnextcloud-server-77a5491d9d18f5dc1a7ea438151292a7472853b3.tar.gz
nextcloud-server-77a5491d9d18f5dc1a7ea438151292a7472853b3.zip
Make sure the UID is correctly cased
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/lib/Command/TransferOwnership.php14
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>");