summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Command
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2019-01-03 18:31:10 +0100
committerThomas Citharel <tcit@tcit.fr>2019-01-16 13:58:34 +0100
commit4864b1865bb7592132443ff8dc0a640ca7ea2cd9 (patch)
treeefaf7688db1b3bd9eb6de805038f7113f34e0c5d /apps/dav/lib/Command
parent4a2238c75be9b0ed4be17869878c04cb812d276f (diff)
downloadnextcloud-server-4864b1865bb7592132443ff8dc0a640ca7ea2cd9.tar.gz
nextcloud-server-4864b1865bb7592132443ff8dc0a640ca7ea2cd9.zip
Don't check group shares if shareWithGroupMembersOnly is false
Signed-off-by: Thomas Citharel <tcit@tcit.fr> Remove the system user check Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'apps/dav/lib/Command')
-rw-r--r--apps/dav/lib/Command/MoveCalendar.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/apps/dav/lib/Command/MoveCalendar.php b/apps/dav/lib/Command/MoveCalendar.php
index 0c2e6daa051..23aee0f2d86 100644
--- a/apps/dav/lib/Command/MoveCalendar.php
+++ b/apps/dav/lib/Command/MoveCalendar.php
@@ -28,7 +28,7 @@ use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IUserManager;
use OCP\IUserSession;
-use OCP\Share\IManager;
+use OCP\Share\IManager as IShareManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -41,9 +41,12 @@ class MoveCalendar extends Command {
/** @var IUserManager */
private $userManager;
- /** @var IGroupManager $groupManager */
+ /** @var IGroupManager */
private $groupManager;
+ /** @var IShareManager */
+ private $shareManager;
+
/** @var IConfig $config */
private $config;
@@ -61,6 +64,7 @@ class MoveCalendar extends Command {
/**
* @param IUserManager $userManager
* @param IGroupManager $groupManager
+ * @param IShareManager $shareManager
* @param IConfig $config
* @param IL10N $l10n
* @param CalDavBackend $calDav
@@ -68,6 +72,7 @@ class MoveCalendar extends Command {
function __construct(
IUserManager $userManager,
IGroupManager $groupManager,
+ IShareManager $shareManager,
IConfig $config,
IL10N $l10n,
CalDavBackend $calDav
@@ -75,6 +80,7 @@ class MoveCalendar extends Command {
parent::__construct();
$this->userManager = $userManager;
$this->groupManager = $groupManager;
+ $this->shareManager = $shareManager;
$this->config = $config;
$this->l10n = $l10n;
$this->calDav = $calDav;
@@ -102,15 +108,10 @@ class MoveCalendar extends Command {
$this->io = new SymfonyStyle($input, $output);
- if (in_array('system', [$userOrigin, $userDestination], true)) {
- throw new \InvalidArgumentException("User can't be system");
- }
-
if (!$this->userManager->userExists($userOrigin)) {
throw new \InvalidArgumentException("User <$userOrigin> is unknown.");
}
-
if (!$this->userManager->userExists($userDestination)) {
throw new \InvalidArgumentException("User <$userDestination> is unknown.");
}
@@ -127,7 +128,9 @@ class MoveCalendar extends Command {
throw new \InvalidArgumentException("User <$userDestination> already has a calendar named <$name>.");
}
- $this->checkShares($calendar, $userDestination, $input->getOption('force'));
+ if ($this->shareManager->shareWithGroupMembersOnly() === true) {
+ $this->checkShares($calendar, $userDestination, $input->getOption('force'));
+ }
$this->calDav->moveCalendar($name, self::URI_USERS . $userOrigin, self::URI_USERS . $userDestination);