Make sure the UID is correctly cased
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
55f5f5061d
commit
6902fb578f
|
@ -28,6 +28,7 @@ use OC\Files\Filesystem;
|
||||||
use OC\Files\View;
|
use OC\Files\View;
|
||||||
use OCP\Files\FileInfo;
|
use OCP\Files\FileInfo;
|
||||||
use OCP\Files\Mount\IMountManager;
|
use OCP\Files\Mount\IMountManager;
|
||||||
|
use OCP\IUser;
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
use OCP\Share\IManager;
|
use OCP\Share\IManager;
|
||||||
use OCP\Share\IShare;
|
use OCP\Share\IShare;
|
||||||
|
@ -92,15 +93,21 @@ class TransferOwnership extends Command {
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||||
$this->sourceUser = $input->getArgument('source-user');
|
$this->sourceUser = $input->getArgument('source-user');
|
||||||
$this->destinationUser = $input->getArgument('destination-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>");
|
$output->writeln("<error>Unknown source user $this->sourceUser</error>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!$this->userManager->userExists($this->destinationUser)) {
|
if (!$destination instanceof IUser) {
|
||||||
$output->writeln("<error>Unknown destination user $this->destinationUser</error>");
|
$output->writeln("<error>Unknown destination user $this->destinationUser</error>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->sourceUser = $source->getUID();
|
||||||
|
$this->destinationUser = $destination->getUID();
|
||||||
|
|
||||||
// target user has to be ready
|
// target user has to be ready
|
||||||
if (!\OC::$server->getEncryptionManager()->isReadyForUser($this->destinationUser)) {
|
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>");
|
$output->writeln("<error>The target user is not ready to accept files. The user has at least to be logged in once.</error>");
|
||||||
|
|
Loading…
Reference in New Issue