diff options
Diffstat (limited to 'lib/private/share20/manager.php')
-rw-r--r-- | lib/private/share20/manager.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php index 3c5bd197ae8..438396501e3 100644 --- a/lib/private/share20/manager.php +++ b/lib/private/share20/manager.php @@ -715,6 +715,25 @@ class Manager implements IManager { } /** + * @inheritdoc + */ + public function moveShare(\OCP\Share\IShare $share, IUser $recipient) { + if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + throw new \InvalidArgumentException('Can\'t change target of link share'); + } + + if (($share->getShareType() === \OCP\Share::SHARE_TYPE_USER && $share->getSharedWith() !== $recipient) || + ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP && !$share->getSharedWith()->inGroup($recipient))) { + throw new \InvalidArgumentException('Invalid recipient'); + } + + list($providerId, ) = $this->splitFullId($share->getId()); + $provider = $this->factory->getProvider($providerId); + + $provider->move($share, $recipient); + } + + /** * Get shares shared by (initiated) by the provided user. * * @param IUser $user |