mirror of
https://github.com/nextcloud/server.git
synced 2026-05-25 02:34:12 -04:00
Disable sharing calendars via link adjusted
Fixes: 45eefc221d
Related: https://github.com/nextcloud/server/pull/34372
Author-Change-Id: IB#1126264
Signed-off-by: Pawel Boguslawski <pawel.boguslawski@ib.pl>
This commit is contained in:
parent
f931259108
commit
bbaf2af416
4 changed files with 12 additions and 19 deletions
|
|
@ -3,7 +3,6 @@
|
|||
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
||||
* @copyright Copyright (c) 2018 Georg Ehrke
|
||||
* @copyright Copyright (c) 2020, leith abdulla (<online-nextcloud@eleith.com>)
|
||||
* @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
|
||||
*
|
||||
* @author Chih-Hsuan Yen <yan12125@gmail.com>
|
||||
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
|
|
@ -498,10 +497,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @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';
|
||||
|
|
@ -560,10 +555,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @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';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
||||
* @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
|
||||
*
|
||||
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
* @author Georg Ehrke <oc.list@georgehrke.com>
|
||||
|
|
@ -29,6 +30,7 @@ use OCP\IConfig;
|
|||
use OCP\IL10N;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Sabre\DAV\Collection;
|
||||
use Sabre\DAV\Exception\Forbidden;
|
||||
|
||||
class PublicCalendarRoot extends Collection {
|
||||
|
||||
|
|
@ -70,6 +72,10 @@ class PublicCalendarRoot extends Collection {
|
|||
* @inheritdoc
|
||||
*/
|
||||
public function getChild($name) {
|
||||
// Sharing via link is allowed by default, but if the option is set it should be checked.
|
||||
if ($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'no' ) {
|
||||
throw new \Sabre\DAV\Exception\Forbidden();
|
||||
}
|
||||
$calendar = $this->caldavBackend->getPublicCalendar($name);
|
||||
return new PublicCalendar($this->caldavBackend, $calendar, $this->l10n, $this->config, $this->logger);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2016 Thomas Citharel <tcit@tcit.fr>
|
||||
* @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
|
||||
*
|
||||
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
||||
* @author Georg Ehrke <oc.list@georgehrke.com>
|
||||
|
|
@ -206,11 +205,6 @@ class PublishPlugin extends ServerPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
|
|
|||
|
|
@ -184,10 +184,12 @@ class Server {
|
|||
|
||||
$this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin());
|
||||
$this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest(), \OC::$server->getConfig()));
|
||||
$this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin(
|
||||
\OC::$server->getConfig(),
|
||||
\OC::$server->getURLGenerator()
|
||||
));
|
||||
if (\OC::$server->getConfig()->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes') {
|
||||
$this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin(
|
||||
\OC::$server->getConfig(),
|
||||
\OC::$server->getURLGenerator()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// addressbook plugins
|
||||
|
|
|
|||
Loading…
Reference in a new issue