summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2017-10-21 11:19:01 +0200
committerGeorg Ehrke <developer@georgehrke.com>2017-11-11 02:15:56 +0100
commitd59b3392abf021d0289b5b2ea1a67bc99e8d89da (patch)
tree95a408cf05f962399945830a9053de5f58768d42 /apps/dav/lib
parent1c106a66b1b287eec177204b71c40ed00a450268 (diff)
downloadnextcloud-server-d59b3392abf021d0289b5b2ea1a67bc99e8d89da.tar.gz
nextcloud-server-d59b3392abf021d0289b5b2ea1a67bc99e8d89da.zip
disallow users to create calendars with reserved names
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/CalDAV/CalendarHome.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/CalendarHome.php b/apps/dav/lib/CalDAV/CalendarHome.php
index c1988c7493e..3e645db459f 100644
--- a/apps/dav/lib/CalDAV/CalendarHome.php
+++ b/apps/dav/lib/CalDAV/CalendarHome.php
@@ -32,6 +32,8 @@ use Sabre\CalDAV\Schedule\Inbox;
use Sabre\CalDAV\Schedule\Outbox;
use Sabre\CalDAV\Subscriptions\Subscription;
use Sabre\DAV\Exception\NotFound;
+use Sabre\DAV\Exception\MethodNotAllowed;
+use Sabre\DAV\MkCol;
class CalendarHome extends \Sabre\CalDAV\CalendarHome {
@@ -57,6 +59,19 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
/**
* @inheritdoc
*/
+ function createExtendedCollection($name, MkCol $mkCol) {
+ $reservedNames = [BirthdayService::BIRTHDAY_CALENDAR_URI];
+
+ if (in_array($name, $reservedNames)) {
+ throw new MethodNotAllowed('The resource you tried to create has a reserved name');
+ }
+
+ parent::createExtendedCollection($name, $mkCol);
+ }
+
+ /**
+ * @inheritdoc
+ */
function getChildren() {
$calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']);
$objects = [];