diff options
author | Sujith Haridasan <sujith.h@gmail.com> | 2020-10-09 10:50:03 +0530 |
---|---|---|
committer | Sujith Haridasan <sujith.h@gmail.com> | 2020-10-12 09:31:49 +0530 |
commit | 08bdc549bbce3d950093450cfdd1f229d1bdefb1 (patch) | |
tree | a6d7730be4b4ababfa0b7805b75783619d223ad0 | |
parent | 8ae4ff6648a0c200e775b5a555631a8758546ae0 (diff) | |
download | nextcloud-server-08bdc549bbce3d950093450cfdd1f229d1bdefb1.tar.gz nextcloud-server-08bdc549bbce3d950093450cfdd1f229d1bdefb1.zip |
Stop transfer of ownership between same users
Stop the transfer of ownership between same user.
Signed-off-by: Sujith Haridasan <sujith.h@gmail.com>
-rw-r--r-- | apps/files/lib/Command/TransferOwnership.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php index 92d8fba8f27..1a2f6167b29 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("<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')); |