Skip to content

Commit 588574d

Browse files
pboguslawskitcitworld
authored andcommitted
Disable sharing calendars via link when sharik via link is disabled
This mod disallows sharing calendars via link when `shareapi_allow_links` is disabled. Related: nextcloud/calendar#525 Related: nextcloud/calendar#4399 Author-Change-Id: IB#1126264 Signed-off-by: Pawel Boguslawski <pawel.boguslawski@ib.pl>
1 parent 12815c1 commit 588574d

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

apps/dav/lib/CalDAV/CalDavBackend.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* @copyright Copyright (c) 2016, ownCloud, Inc.
44
* @copyright Copyright (c) 2018 Georg Ehrke
55
* @copyright Copyright (c) 2020, leith abdulla (<online-nextcloud@eleith.com>)
6+
* @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
67
*
78
* @author Chih-Hsuan Yen <yan12125@gmail.com>
89
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
@@ -516,6 +517,10 @@ private function getUserDisplayName($uid) {
516517
* @return array
517518
*/
518519
public function getPublicCalendars() {
520+
// Sharing via link must be enabled.
521+
if ($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'no' ) {
522+
return array_values([]);
523+
}
519524
$fields = array_column($this->propertyMap, 0);
520525
$fields[] = 'a.id';
521526
$fields[] = 'a.uri';
@@ -574,6 +579,10 @@ public function getPublicCalendars() {
574579
* @throws NotFound
575580
*/
576581
public function getPublicCalendar($uri) {
582+
// Sharing via link must be enabled.
583+
if ($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'no' ) {
584+
throw new NotFound('Node with name \'' . $uri . '\' could not be found');
585+
}
577586
$fields = array_column($this->propertyMap, 0);
578587
$fields[] = 'a.id';
579588
$fields[] = 'a.uri';

apps/dav/lib/CalDAV/Publishing/PublishPlugin.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @copyright Copyright (c) 2016 Thomas Citharel <tcit@tcit.fr>
4+
* @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
45
*
56
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
67
* @author Georg Ehrke <oc.list@georgehrke.com>
@@ -205,6 +206,11 @@ public function httpPost(RequestInterface $request, ResponseInterface $response)
205206
}
206207
}
207208

209+
// Sharing via link must be enabled.
210+
if ($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'no') {
211+
return;
212+
}
213+
208214
$node->setPublishStatus(true);
209215

210216
// iCloud sends back the 202, so we will too.

0 commit comments

Comments
 (0)