diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index b00a4f9d6ed73..4e5efd12e2b30 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -3,6 +3,7 @@ * @copyright Copyright (c) 2016, ownCloud, Inc. * @copyright Copyright (c) 2018 Georg Ehrke * @copyright Copyright (c) 2020, leith abdulla () + * @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/ * * @author Chih-Hsuan Yen * @author Christoph Wurst @@ -516,6 +517,10 @@ private function getUserDisplayName($uid) { * @return array */ public function getPublicCalendars() { + // Sharing via link must be enabled. + if ($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'no' ) { + return array_values([]); + } $fields = array_column($this->propertyMap, 0); $fields[] = 'a.id'; $fields[] = 'a.uri'; @@ -574,6 +579,10 @@ public function getPublicCalendars() { * @throws NotFound */ public function getPublicCalendar($uri) { + // Sharing via link must be enabled. + if ($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'no' ) { + throw new NotFound('Node with name \'' . $uri . '\' could not be found'); + } $fields = array_column($this->propertyMap, 0); $fields[] = 'a.id'; $fields[] = 'a.uri'; diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php index aabf78da1aa8b..e0078fa1fefd6 100644 --- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php +++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php @@ -1,6 +1,7 @@ + * @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/ * * @author Christoph Wurst * @author Georg Ehrke @@ -205,6 +206,11 @@ public function httpPost(RequestInterface $request, ResponseInterface $response) } } + // Sharing via link must be enabled. + if ($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'no') { + return; + } + $node->setPublishStatus(true); // iCloud sends back the 202, so we will too.