diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-10-12 21:52:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-12 21:52:37 +0200 |
commit | deb499d34e7e4760db22d250b4cb1449e981d98c (patch) | |
tree | 70983fc94353ad6a19a9c6b1503d9970efb5aee6 /apps | |
parent | 78da9532ba9c9d9ea1e83ecfce95f31d4d6b6afd (diff) | |
parent | 08bdc549bbce3d950093450cfdd1f229d1bdefb1 (diff) | |
download | nextcloud-server-deb499d34e7e4760db22d250b4cb1449e981d98c.tar.gz nextcloud-server-deb499d34e7e4760db22d250b4cb1449e981d98c.zip |
Merge pull request #23300 from sharidas/transfer-ownership-same-user
Stop transfer of ownership between same users
Diffstat (limited to 'apps')
-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')); |