From 67fa9edef0e30970b29d582e7a71c76e23452896 Mon Sep 17 00:00:00 2001 From: Sujith Haridasan Date: Fri, 9 Oct 2020 10:50:03 +0530 Subject: [PATCH] Stop transfer of ownership between same users Stop the transfer of ownership between same user. Signed-off-by: Sujith Haridasan --- apps/files/lib/Command/TransferOwnership.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php index 92d8fba8f2..1a2f6167b2 100644 --- a/apps/files/lib/Command/TransferOwnership.php +++ b/apps/files/lib/Command/TransferOwnership.php @@ -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("Ownership can't be transferred when Source and Destination users are the same user. Please check your input."); + return 1; + } + $sourceUserObject = $this->userManager->get($input->getArgument('source-user')); $destinationUserObject = $this->userManager->get($input->getArgument('destination-user'));