diff options
author | Joas Schilling <coding@schilljs.com> | 2019-09-04 16:50:52 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-11-12 17:36:58 +0100 |
commit | 520042bbd0512e19717d18705c3b045b2d8400a7 (patch) | |
tree | 286e21a2dd06feca025a7dabe2dcbb63d65c5498 /lib/private/Share20/Manager.php | |
parent | c79a56481bc4bd9fb94b0dfbf483537400c76569 (diff) | |
download | nextcloud-server-520042bbd0512e19717d18705c3b045b2d8400a7.tar.gz nextcloud-server-520042bbd0512e19717d18705c3b045b2d8400a7.zip |
Allow to accept group shares
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Share20/Manager.php')
-rw-r--r-- | lib/private/Share20/Manager.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 728dd60e759..ba370e7724a 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -929,6 +929,30 @@ class Manager implements IManager { } /** + * Accept a share. + * + * @param IShare $share + * @param string $recipientId + * @return IShare The share object + * @throws \InvalidArgumentException + * @since 9.0.0 + */ + public function acceptShare(IShare $share, string $recipientId): IShare { + [$providerId, ] = $this->splitFullId($share->getFullId()); + $provider = $this->factory->getProvider($providerId); + + if (!method_exists($provider, 'acceptShare')) { + // TODO FIX ME + throw new \InvalidArgumentException('not supported'); + } + $provider->acceptShare($share, $recipientId); + $event = new GenericEvent($share); + $this->eventDispatcher->dispatch('OCP\Share::postAcceptShare', $event); + + return $share; + } + + /** * Updates the password of the given share if it is not the same as the * password of the original share. * |