diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-12-12 21:38:52 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-12-16 09:07:25 +0100 |
commit | bb4264c565963f07c087a4aebc47ff6ca0d59686 (patch) | |
tree | 1a60ad4d122a1af6b99d2e1ef6e0f9867a64c63d /lib/private/Share20 | |
parent | 87104ce5100f905dab3ce056f05847fad5dde393 (diff) | |
download | nextcloud-server-bb4264c565963f07c087a4aebc47ff6ca0d59686.tar.gz nextcloud-server-bb4264c565963f07c087a4aebc47ff6ca0d59686.zip |
config.php setting to always accept internal shares
Part of #18255
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Share20')
-rw-r--r-- | lib/private/Share20/Manager.php | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 42db0d8af5d..4c94cf26a4d 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -44,6 +44,7 @@ use OC\Cache\CappedMemoryCache; use OC\Files\Mount\MoveableMount; use OC\HintException; use OC\Share20\Exception\ProviderException; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\IRootFolder; @@ -101,7 +102,7 @@ class Manager implements IManager { /** @var CappedMemoryCache */ private $sharingDisabledForUsersCache; /** @var EventDispatcherInterface */ - private $eventDispatcher; + private $legacyDispatcher; /** @var LegacyHooks */ private $legacyHooks; /** @var IMailer */ @@ -110,6 +111,8 @@ class Manager implements IManager { private $urlGenerator; /** @var \OC_Defaults */ private $defaults; + /** @var IEventDispatcher */ + private $dispatcher; /** @@ -143,10 +146,11 @@ class Manager implements IManager { IProviderFactory $factory, IUserManager $userManager, IRootFolder $rootFolder, - EventDispatcherInterface $eventDispatcher, + EventDispatcherInterface $legacyDispatcher, IMailer $mailer, IURLGenerator $urlGenerator, - \OC_Defaults $defaults + \OC_Defaults $defaults, + IEventDispatcher $dispatcher ) { $this->logger = $logger; $this->config = $config; @@ -159,12 +163,13 @@ class Manager implements IManager { $this->factory = $factory; $this->userManager = $userManager; $this->rootFolder = $rootFolder; - $this->eventDispatcher = $eventDispatcher; + $this->legacyDispatcher = $legacyDispatcher; $this->sharingDisabledForUsersCache = new CappedMemoryCache(); - $this->legacyHooks = new LegacyHooks($this->eventDispatcher); + $this->legacyHooks = new LegacyHooks($this->legacyDispatcher); $this->mailer = $mailer; $this->urlGenerator = $urlGenerator; $this->defaults = $defaults; + $this->dispatcher = $dispatcher; } /** @@ -195,7 +200,7 @@ class Manager implements IManager { // Let others verify the password try { - $this->eventDispatcher->dispatch(new ValidatePasswordPolicyEvent($password)); + $this->legacyDispatcher->dispatch(new ValidatePasswordPolicyEvent($password)); } catch (HintException $e) { throw new \Exception($e->getHint()); } @@ -766,7 +771,7 @@ class Manager implements IManager { // Pre share event $event = new GenericEvent($share); - $this->eventDispatcher->dispatch('OCP\Share::preShare', $event); + $this->legacyDispatcher->dispatch('OCP\Share::preShare', $event); if ($event->isPropagationStopped() && $event->hasArgument('error')) { throw new \Exception($event->getArgument('error')); } @@ -779,7 +784,9 @@ class Manager implements IManager { // Post share event $event = new GenericEvent($share); - $this->eventDispatcher->dispatch('OCP\Share::postShare', $event); + $this->legacyDispatcher->dispatch('OCP\Share::postShare', $event); + + $this->dispatcher->dispatchTyped(new Share\Events\ShareCreatedEvent($share)); if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { $mailSend = $share->getMailSend(); @@ -1041,7 +1048,7 @@ class Manager implements IManager { } $provider->acceptShare($share, $recipientId); $event = new GenericEvent($share); - $this->eventDispatcher->dispatch('OCP\Share::postAcceptShare', $event); + $this->legacyDispatcher->dispatch('OCP\Share::postAcceptShare', $event); return $share; } @@ -1111,7 +1118,7 @@ class Manager implements IManager { } $event = new GenericEvent($share); - $this->eventDispatcher->dispatch('OCP\Share::preUnshare', $event); + $this->legacyDispatcher->dispatch('OCP\Share::preUnshare', $event); // Get all children and delete them as well $deletedShares = $this->deleteChildren($share); @@ -1125,7 +1132,7 @@ class Manager implements IManager { // Emit post hook $event->setArgument('deletedShares', $deletedShares); - $this->eventDispatcher->dispatch('OCP\Share::postUnshare', $event); + $this->legacyDispatcher->dispatch('OCP\Share::postUnshare', $event); } @@ -1144,7 +1151,7 @@ class Manager implements IManager { $provider->deleteFromSelf($share, $recipientId); $event = new GenericEvent($share); - $this->eventDispatcher->dispatch('OCP\Share::postUnshareFromSelf', $event); + $this->legacyDispatcher->dispatch('OCP\Share::postUnshareFromSelf', $event); } public function restoreShare(IShare $share, string $recipientId): IShare { |