config.php setting to always accept internal shares

Part of #18255

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-12-12 21:38:52 +01:00
parent 87104ce510
commit bb4264c565
No known key found for this signature in database
GPG Key ID: F941078878347C0C
11 changed files with 211 additions and 61 deletions

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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);
}
}
}
}

View File

@ -1338,6 +1338,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
*/

View File

@ -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',

View File

@ -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',

View File

@ -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;

View File

@ -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 {

View File

@ -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;
}
}

View File

@ -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 cant 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 cant 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('Cant 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('Cant 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('Cant 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('Cant 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('Cant 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('Cant 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('Cant 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);