]> source.dussan.org Git - nextcloud-server.git/commitdiff
Stop transfer of ownership between same users 23300/head
authorSujith Haridasan <sujith.h@gmail.com>
Fri, 9 Oct 2020 05:20:03 +0000 (10:50 +0530)
committerSujith Haridasan <sujith.h@gmail.com>
Mon, 12 Oct 2020 04:01:49 +0000 (09:31 +0530)
Stop the transfer of ownership between same user.

Signed-off-by: Sujith Haridasan <sujith.h@gmail.com>
apps/files/lib/Command/TransferOwnership.php

index 92d8fba8f27707d8d3fcd4a12fd1cd7368c96259..1a2f6167b2962ba017f3a7bf72da55664ac89e09 100644 (file)
@@ -87,6 +87,16 @@ class TransferOwnership extends Command {
        }
 
        protected function execute(InputInterface $input, OutputInterface $output): int {
+
+               /**
+                * Check if source and destination users are same. If they are same then just ignore the transfer.
+                */
+
+               if ($input->getArgument(('source-user')) === $input->getArgument('destination-user')) {
+                       $output->writeln("<error>Ownership can't be transferred when Source and Destination users are the same user. Please check your input.</error>");
+                       return 1;
+               }
+
                $sourceUserObject = $this->userManager->get($input->getArgument('source-user'));
                $destinationUserObject = $this->userManager->get($input->getArgument('destination-user'));