summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Command/MoveCalendar.php
diff options
context:
space:
mode:
authorAnna <anna@nextcloud.com>2022-03-16 15:41:09 +0100
committerGitHub <noreply@github.com>2022-03-16 15:41:09 +0100
commit629bcf15494305f92f4db797f2d83e44f55baa35 (patch)
treee4f46ed2f6a575ab0912562718e226f6d912d34f /apps/dav/lib/Command/MoveCalendar.php
parent92a63e6189368447f28bc5de13151750286d9021 (diff)
parent0745fc50126e92406ec95265ef1ff5d4b5575d3e (diff)
downloadnextcloud-server-629bcf15494305f92f4db797f2d83e44f55baa35.tar.gz
nextcloud-server-629bcf15494305f92f4db797f2d83e44f55baa35.zip
Merge pull request #30120 from nextcloud/enhancement/move-calendar-objects
Move calendar objects between calendars
Diffstat (limited to 'apps/dav/lib/Command/MoveCalendar.php')
-rw-r--r--apps/dav/lib/Command/MoveCalendar.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/dav/lib/Command/MoveCalendar.php b/apps/dav/lib/Command/MoveCalendar.php
index e6cba3b3330..320fe8aeac6 100644
--- a/apps/dav/lib/Command/MoveCalendar.php
+++ b/apps/dav/lib/Command/MoveCalendar.php
@@ -33,6 +33,7 @@ use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IUserManager;
use OCP\Share\IManager as IShareManager;
+use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -63,6 +64,9 @@ class MoveCalendar extends Command {
/** @var CalDavBackend */
private $calDav;
+ /** @var LoggerInterface */
+ private $logger;
+
public const URI_USERS = 'principals/users/';
/**
@@ -79,7 +83,8 @@ class MoveCalendar extends Command {
IShareManager $shareManager,
IConfig $config,
IL10N $l10n,
- CalDavBackend $calDav
+ CalDavBackend $calDav,
+ LoggerInterface $logger
) {
parent::__construct();
$this->userManager = $userManager;
@@ -88,6 +93,7 @@ class MoveCalendar extends Command {
$this->config = $config;
$this->l10n = $l10n;
$this->calDav = $calDav;
+ $this->logger = $logger;
}
protected function configure() {
@@ -218,7 +224,7 @@ class MoveCalendar extends Command {
*/
if ($this->shareManager->shareWithGroupMembersOnly() === true && 'groups' === $prefix && !$this->groupManager->isInGroup($userDestination, $userOrGroup)) {
if ($force) {
- $this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config), [], ['href' => 'principal:principals/groups/' . $userOrGroup]);
+ $this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config, $this->logger), [], ['href' => 'principal:principals/groups/' . $userOrGroup]);
} else {
throw new \InvalidArgumentException("User <$userDestination> is not part of the group <$userOrGroup> with whom the calendar <" . $calendar['uri'] . "> was shared. You may use -f to move the calendar while deleting this share.");
}
@@ -229,7 +235,7 @@ class MoveCalendar extends Command {
*/
if ($userOrGroup === $userDestination) {
if ($force) {
- $this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config), [], ['href' => 'principal:principals/users/' . $userOrGroup]);
+ $this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config, $this->logger), [], ['href' => 'principal:principals/users/' . $userOrGroup]);
} else {
throw new \InvalidArgumentException("The calendar <" . $calendar['uri'] . "> is already shared to user <$userDestination>.You may use -f to move the calendar while deleting this share.");
}