Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/files_sharing/composer/composer/autoload_classmap.php1
-rw-r--r--apps/files_sharing/composer/composer/autoload_static.php1
-rw-r--r--apps/files_sharing/lib/AppInfo/Application.php13
-rw-r--r--apps/files_sharing/lib/Listener/GlobalShareAcceptanceListener.php61
-rw-r--r--config/config.sample.php7
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/private/Server.php3
-rw-r--r--lib/private/Share20/Manager.php31
-rw-r--r--lib/public/Share/Events/ShareCreatedEvent.php53
-rw-r--r--tests/lib/Share20/ManagerTest.php100
11 files changed, 211 insertions, 61 deletions
diff --git a/apps/files_sharing/composer/composer/autoload_classmap.php b/apps/files_sharing/composer/composer/autoload_classmap.php
index 3a2b1159320..0e02973b5d4 100644
--- a/apps/files_sharing/composer/composer/autoload_classmap.php
+++ b/apps/files_sharing/composer/composer/autoload_classmap.php
@@ -46,6 +46,7 @@ return array(
'OCA\\Files_Sharing\\Helper' => $baseDir . '/../lib/Helper.php',
'OCA\\Files_Sharing\\Hooks' => $baseDir . '/../lib/Hooks.php',
'OCA\\Files_Sharing\\ISharedStorage' => $baseDir . '/../lib/ISharedStorage.php',
+ 'OCA\\Files_Sharing\\Listener\\GlobalShareAcceptanceListener' => $baseDir . '/../lib/Listener/GlobalShareAcceptanceListener.php',
'OCA\\Files_Sharing\\Listener\\LoadAdditionalListener' => $baseDir . '/../lib/Listener/LoadAdditionalListener.php',
'OCA\\Files_Sharing\\Listener\\LoadSidebarListener' => $baseDir . '/../lib/Listener/LoadSidebarListener.php',
'OCA\\Files_Sharing\\Middleware\\OCSShareAPIMiddleware' => $baseDir . '/../lib/Middleware/OCSShareAPIMiddleware.php',
diff --git a/apps/files_sharing/composer/composer/autoload_static.php b/apps/files_sharing/composer/composer/autoload_static.php
index 1c1322f6c3e..3d304583501 100644
--- a/apps/files_sharing/composer/composer/autoload_static.php
+++ b/apps/files_sharing/composer/composer/autoload_static.php
@@ -61,6 +61,7 @@ class ComposerStaticInitFiles_Sharing
'OCA\\Files_Sharing\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php',
'OCA\\Files_Sharing\\Hooks' => __DIR__ . '/..' . '/../lib/Hooks.php',
'OCA\\Files_Sharing\\ISharedStorage' => __DIR__ . '/..' . '/../lib/ISharedStorage.php',
+ 'OCA\\Files_Sharing\\Listener\\GlobalShareAcceptanceListener' => __DIR__ . '/..' . '/../lib/Listener/GlobalShareAcceptanceListener.php',
'OCA\\Files_Sharing\\Listener\\LoadAdditionalListener' => __DIR__ . '/..' . '/../lib/Listener/LoadAdditionalListener.php',
'OCA\\Files_Sharing\\Listener\\LoadSidebarListener' => __DIR__ . '/..' . '/../lib/Listener/LoadSidebarListener.php',
'OCA\\Files_Sharing\\Middleware\\OCSShareAPIMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/OCSShareAPIMiddleware.php',
diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php
index 8b83fea2e8e..840f8a809ff 100644
--- a/apps/files_sharing/lib/AppInfo/Application.php
+++ b/apps/files_sharing/lib/AppInfo/Application.php
@@ -35,6 +35,7 @@ use OCA\Files_Sharing\Capabilities;
use OCA\Files_Sharing\Controller\ExternalSharesController;
use OCA\Files_Sharing\Controller\ShareController;
use OCA\Files_Sharing\External\Manager;
+use OCA\Files_Sharing\Listener\GlobalShareAcceptanceListener;
use OCA\Files_Sharing\Listener\LoadAdditionalListener;
use OCA\Files_Sharing\Listener\LoadSidebarListener;
use OCA\Files_Sharing\Middleware\OCSShareAPIMiddleware;
@@ -54,6 +55,7 @@ use OCP\Files\Config\IMountProviderCollection;
use OCP\IContainer;
use OCP\IGroup;
use OCP\IServerContainer;
+use OCP\Share\Events\ShareCreatedEvent;
use OCP\Util;
use Symfony\Component\EventDispatcher\GenericEvent;
@@ -210,6 +212,7 @@ class Application extends App {
$dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function() {
\OCP\Util::addScript('files_sharing', 'dist/collaboration');
});
+ $dispatcher->addServiceListener(ShareCreatedEvent::class, GlobalShareAcceptanceListener::class);
// notifications api to accept incoming user shares
$dispatcher->addListener('OCP\Share::postShare', function(GenericEvent $event) {
@@ -233,7 +236,7 @@ class Application extends App {
}
$sharingSublistArray = [];
-
+
if (\OCP\Util::isSharingDisabledForUser() === false) {
array_push($sharingSublistArray, [
'id' => 'sharingout',
@@ -243,7 +246,7 @@ class Application extends App {
'name' => $l->t('Shared with others'),
]);
}
-
+
array_push($sharingSublistArray, [
'id' => 'sharingin',
'appname' => 'files_sharing',
@@ -251,7 +254,7 @@ class Application extends App {
'order' => 15,
'name' => $l->t('Shared with you'),
]);
-
+
if (\OCP\Util::isSharingDisabledForUser() === false) {
// Check if sharing by link is enabled
if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') {
@@ -264,7 +267,7 @@ class Application extends App {
]);
}
}
-
+
array_push($sharingSublistArray, [
'id' => 'deletedshares',
'appname' => 'files_sharing',
@@ -272,7 +275,7 @@ class Application extends App {
'order' => 19,
'name' => $l->t('Deleted shares'),
]);
-
+
// show_Quick_Access stored as string
\OCA\Files\App::getNavigationManager()->add([
'id' => 'shareoverview',
diff --git a/apps/files_sharing/lib/Listener/GlobalShareAcceptanceListener.php b/apps/files_sharing/lib/Listener/GlobalShareAcceptanceListener.php
new file mode 100644
index 00000000000..d30801a8fd4
--- /dev/null
+++ b/apps/files_sharing/lib/Listener/GlobalShareAcceptanceListener.php
@@ -0,0 +1,61 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Files_Sharing\Listener;
+
+use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventListener;
+use OCP\IConfig;
+use OCP\Share\Events\ShareCreatedEvent;
+use OCP\Share\IManager;
+use OCP\Share\IShare;
+
+class GlobalShareAcceptanceListener implements IEventListener {
+
+ /** @var IConfig */
+ private $config;
+ /** @var IManager */
+ private $shareManager;
+
+ public function __construct(IConfig $config, IManager $shareManager) {
+ $this->config = $config;
+ $this->shareManager = $shareManager;
+ }
+
+ public function handle(Event $event): void {
+ if (!($event instanceof ShareCreatedEvent)) {
+ return;
+ }
+
+ if ($this->config->getSystemValueBool('sharing.interal_shares_accepted', false)) {
+ $share = $event->getShare();
+
+ if ($share->getShareType() === IShare::TYPE_USER || $share->getShareType() === IShare::TYPE_GROUP) {
+ $share->setStatus(IShare::STATUS_ACCEPTED);
+ $this->shareManager->updateShare($share);
+ }
+ }
+ }
+
+}
diff --git a/config/config.sample.php b/config/config.sample.php
index d998ce560bc..d297f86d738 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -1339,6 +1339,13 @@ $CONFIG = array(
'sharing.minSearchStringLength' => 0,
/**
+ * Starting with Nextcloud 18 also internal shares have to be accepted. Setting
+ * this setting to true forces all internal shares to be accepted directly.
+ * (resulting in pre 18 behavior).
+ */
+'sharing.interal_shares_accepted' => false,
+
+/**
* All other configuration options
*/
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 016b3c360ef..bfc024e5851 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -418,6 +418,7 @@ return array(
'OCP\\Settings\\ISettings' => $baseDir . '/lib/public/Settings/ISettings.php',
'OCP\\Settings\\ISubAdminSettings' => $baseDir . '/lib/public/Settings/ISubAdminSettings.php',
'OCP\\Share' => $baseDir . '/lib/public/Share.php',
+ 'OCP\\Share\\Events\\ShareCreatedEvent' => $baseDir . '/lib/public/Share/Events/ShareCreatedEvent.php',
'OCP\\Share\\Exceptions\\GenericShareException' => $baseDir . '/lib/public/Share/Exceptions/GenericShareException.php',
'OCP\\Share\\Exceptions\\IllegalIDChangeException' => $baseDir . '/lib/public/Share/Exceptions/IllegalIDChangeException.php',
'OCP\\Share\\Exceptions\\ShareNotFound' => $baseDir . '/lib/public/Share/Exceptions/ShareNotFound.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 5d63c7740eb..6fe4529c295 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -447,6 +447,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Settings\\ISettings' => __DIR__ . '/../../..' . '/lib/public/Settings/ISettings.php',
'OCP\\Settings\\ISubAdminSettings' => __DIR__ . '/../../..' . '/lib/public/Settings/ISubAdminSettings.php',
'OCP\\Share' => __DIR__ . '/../../..' . '/lib/public/Share.php',
+ 'OCP\\Share\\Events\\ShareCreatedEvent' => __DIR__ . '/../../..' . '/lib/public/Share/Events/ShareCreatedEvent.php',
'OCP\\Share\\Exceptions\\GenericShareException' => __DIR__ . '/../../..' . '/lib/public/Share/Exceptions/GenericShareException.php',
'OCP\\Share\\Exceptions\\IllegalIDChangeException' => __DIR__ . '/../../..' . '/lib/public/Share/Exceptions/IllegalIDChangeException.php',
'OCP\\Share\\Exceptions\\ShareNotFound' => __DIR__ . '/../../..' . '/lib/public/Share/Exceptions/ShareNotFound.php',
diff --git a/lib/private/Server.php b/lib/private/Server.php
index b8765654c3f..0cc3b24992e 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -1171,7 +1171,8 @@ class Server extends ServerContainer implements IServerContainer {
$c->getEventDispatcher(),
$c->getMailer(),
$c->getURLGenerator(),
- $c->getThemingDefaults()
+ $c->getThemingDefaults(),
+ $c->query(IEventDispatcher::class)
);
return $manager;
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 {
diff --git a/lib/public/Share/Events/ShareCreatedEvent.php b/lib/public/Share/Events/ShareCreatedEvent.php
new file mode 100644
index 00000000000..76e25b7f166
--- /dev/null
+++ b/lib/public/Share/Events/ShareCreatedEvent.php
@@ -0,0 +1,53 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Share\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\Share\IShare;
+
+/**
+ * @since 18.0.0
+ */
+class ShareCreatedEvent extends Event {
+
+ /** @var IShare */
+ private $share;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(IShare $share) {
+ parent::__construct();
+
+ $this->share = $share;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function getShare(): IShare {
+ return $this->share;
+ }
+}
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 2320e2afa08..02f779abf51 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -28,6 +28,7 @@ use OC\Share20\Exception;
use OC\Share20\Manager;
use OC\Share20\Share;
use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
@@ -94,6 +95,8 @@ class ManagerTest extends \Test\TestCase {
protected $rootFolder;
/** @var EventDispatcherInterface | MockObject */
protected $eventDispatcher;
+ /** @var IEventDispatcher|MockObject */
+ protected $dispatcher;
/** @var IMailer|MockObject */
protected $mailer;
/** @var IURLGenerator|MockObject */
@@ -115,6 +118,7 @@ class ManagerTest extends \Test\TestCase {
$this->mailer = $this->createMock(IMailer::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->defaults = $this->createMock(\OC_Defaults::class);
+ $this->dispatcher = $this->createMock(IEventDispatcher::class);
$this->l10nFactory = $this->createMock(IFactory::class);
$this->l = $this->createMock(IL10N::class);
@@ -140,7 +144,8 @@ class ManagerTest extends \Test\TestCase {
$this->eventDispatcher,
$this->mailer,
$this->urlGenerator,
- $this->defaults
+ $this->defaults,
+ $this->dispatcher
);
$this->defaultProvider = $this->createMock(DefaultShareProvider::class);
@@ -168,11 +173,12 @@ class ManagerTest extends \Test\TestCase {
$this->eventDispatcher,
$this->mailer,
$this->urlGenerator,
- $this->defaults
+ $this->defaults,
+ $this->dispatcher
]);
}
-
+
public function testDeleteNoShareId() {
$this->expectException(\InvalidArgumentException::class);
@@ -445,7 +451,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($share, $this->manager->getShareById('default:42'));
}
-
+
public function testGetExpiredShareById() {
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
@@ -472,7 +478,7 @@ class ManagerTest extends \Test\TestCase {
$manager->getShareById('default:42');
}
-
+
public function testVerifyPasswordNullButEnforced() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Passwords are enforced for link shares');
@@ -510,7 +516,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertNull($result);
}
-
+
public function testVerifyPasswordHookFails() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('password not accepted');
@@ -719,7 +725,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame($exception, $thrown);
}
-
+
public function testGeneralCheckShareRoot() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('You can’t share your root folder');
@@ -745,7 +751,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'generalCreateChecks', [$share]);
}
-
+
public function testvalidateExpirationDateInPast() {
$this->expectException(\OCP\Share\Exceptions\GenericShareException::class);
$this->expectExceptionMessage('Expiration date is in the past');
@@ -761,7 +767,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'validateExpirationDate', [$share]);
}
-
+
public function testvalidateExpirationDateEnforceButNotSet() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Expiration date is enforced');
@@ -950,7 +956,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($save, $share->getExpirationDate());
}
-
+
public function testValidateExpirationDateHookException() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Invalid date!');
@@ -988,7 +994,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals(null, $share->getExpirationDate());
}
-
+
public function testUserCreateChecksShareWithGroupMembersOnlyDifferentGroups() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Sharing is only allowed with group members');
@@ -1061,7 +1067,7 @@ class ManagerTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
-
+
public function testUserCreateChecksIdenticalShareExists() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Path is already shared with this user');
@@ -1086,7 +1092,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'userCreateChecks', [$share]);
}
-
+
public function testUserCreateChecksIdenticalPathSharedViaGroup() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Path is already shared with this user');
@@ -1197,7 +1203,7 @@ class ManagerTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
-
+
public function testGroupCreateChecksShareWithGroupMembersGroupSharingNotAllowed() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Group sharing is now allowed');
@@ -1213,7 +1219,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
}
-
+
public function testGroupCreateChecksShareWithGroupMembersOnlyNotInGroup() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Sharing is only allowed within your own groups');
@@ -1239,7 +1245,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
}
-
+
public function testGroupCreateChecksShareWithGroupMembersOnlyNullGroup() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Sharing is only allowed within your own groups');
@@ -1292,7 +1298,7 @@ class ManagerTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
-
+
public function testGroupCreateChecksPathAlreadySharedWithSameGroup() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Path is already shared with this group');
@@ -1348,7 +1354,7 @@ class ManagerTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
-
+
public function testLinkCreateChecksNoLinkSharesAllowed() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Link sharing is not allowed');
@@ -1364,7 +1370,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
}
-
+
public function testLinkCreateChecksSharePermissions() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Link shares can’t have reshare permissions');
@@ -1382,7 +1388,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
}
-
+
public function testLinkCreateChecksNoPublicUpload() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Public upload is not allowed');
@@ -1433,7 +1439,7 @@ class ManagerTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
-
+
public function testPathCreateChecksContainsSharedMount() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Path contains files shared with you');
@@ -1925,7 +1931,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals('token', $share->getToken());
}
-
+
public function testCreateShareHookError() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('I won\'t let you share');
@@ -2192,7 +2198,8 @@ class ManagerTest extends \Test\TestCase {
$this->eventDispatcher,
$this->mailer,
$this->urlGenerator,
- $this->defaults
+ $this->defaults,
+ $this->dispatcher
);
$share = $this->createMock(IShare::class);
@@ -2235,7 +2242,8 @@ class ManagerTest extends \Test\TestCase {
$this->eventDispatcher,
$this->mailer,
$this->urlGenerator,
- $this->defaults
+ $this->defaults,
+ $this->dispatcher
);
$share = $this->createMock(IShare::class);
@@ -2285,7 +2293,8 @@ class ManagerTest extends \Test\TestCase {
$this->eventDispatcher,
$this->mailer,
$this->urlGenerator,
- $this->defaults
+ $this->defaults,
+ $this->dispatcher
);
$share = $this->createMock(IShare::class);
@@ -2312,7 +2321,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame($share, $ret);
}
-
+
public function testGetShareByTokenExpired() {
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
$this->expectExceptionMessage('The requested share does not exist anymore');
@@ -2371,7 +2380,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame($share, $res);
}
-
+
public function testGetShareByTokenWithPublicLinksDisabled() {
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
@@ -2467,7 +2476,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertTrue($this->manager->checkPassword($share, 'password'));
}
-
+
public function testUpdateShareCantChangeShareType() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Can’t change share type');
@@ -2493,7 +2502,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
-
+
public function testUpdateShareCantChangeRecipientForGroupShare() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Can only update recipient on user shares');
@@ -2521,7 +2530,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
-
+
public function testUpdateShareCantShareWithOwner() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Can’t share with the share owner');
@@ -2890,7 +2899,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
-
+
public function testUpdateShareMailEnableSendPasswordByTalkWithNoPassword() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Can’t enable sending the password by Talk without setting a new password');
@@ -2962,7 +2971,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
-
+
public function testUpdateShareMailEnableSendPasswordByTalkRemovingPassword() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Can’t enable sending the password by Talk without setting a new password');
@@ -3034,7 +3043,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
-
+
public function testUpdateShareMailEnableSendPasswordByTalkRemovingPasswordWithEmptyString() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Can’t enable sending the password by Talk without setting a new password');
@@ -3106,7 +3115,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
-
+
public function testUpdateShareMailEnableSendPasswordByTalkWithPreviousPassword() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Can’t enable sending the password by Talk without setting a new password');
@@ -3248,7 +3257,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
-
+
public function testMoveShareLink() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Can’t change target of link share');
@@ -3261,7 +3270,7 @@ class ManagerTest extends \Test\TestCase {
$this->manager->moveShare($share, $recipient);
}
-
+
public function testMoveShareUserNotRecipient() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid recipient');
@@ -3288,7 +3297,7 @@ class ManagerTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
-
+
public function testMoveShareGroupNotRecipient() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid recipient');
@@ -3308,7 +3317,7 @@ class ManagerTest extends \Test\TestCase {
$this->manager->moveShare($share, 'recipient');
}
-
+
public function testMoveShareGroupNull() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Group "shareWith" does not exist');
@@ -3375,7 +3384,8 @@ class ManagerTest extends \Test\TestCase {
$this->eventDispatcher,
$this->mailer,
$this->urlGenerator,
- $this->defaults
+ $this->defaults,
+ $this->dispatcher
);
$this->assertSame($expected,
$manager->shareProviderExists($shareType)
@@ -3407,7 +3417,8 @@ class ManagerTest extends \Test\TestCase {
$this->eventDispatcher,
$this->mailer,
$this->urlGenerator,
- $this->defaults
+ $this->defaults,
+ $this->dispatcher
);
$factory->setProvider($this->defaultProvider);
@@ -3470,7 +3481,8 @@ class ManagerTest extends \Test\TestCase {
$this->eventDispatcher,
$this->mailer,
$this->urlGenerator,
- $this->defaults
+ $this->defaults,
+ $this->dispatcher
);
$factory->setProvider($this->defaultProvider);
@@ -3586,7 +3598,8 @@ class ManagerTest extends \Test\TestCase {
$this->eventDispatcher,
$this->mailer,
$this->urlGenerator,
- $this->defaults
+ $this->defaults,
+ $this->dispatcher
);
$factory->setProvider($this->defaultProvider);
@@ -3711,7 +3724,8 @@ class ManagerTest extends \Test\TestCase {
$this->eventDispatcher,
$this->mailer,
$this->urlGenerator,
- $this->defaults
+ $this->defaults,
+ $this->dispatcher
);
$factory->setProvider($this->defaultProvider);