Skip to content
Snippets Groups Projects
Unverified Commit 77a5491d authored by Joas Schilling's avatar Joas Schilling
Browse files

Make sure the UID is correctly cased

parent 96f8f209
No related branches found
No related tags found
No related merge requests found
......@@ -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>");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment