Skip to content

Commit

Permalink
disallow users to create calendars with reserved names
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehrke committed Oct 21, 2017
1 parent 799f7a0 commit 96e6509
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions apps/dav/lib/CalDAV/CalendarHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
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 {

Expand All @@ -52,6 +54,19 @@ public function getCalDAVBackend() {
return $this->caldavBackend;
}

/**
* @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
*/
Expand Down

0 comments on commit 96e6509

Please sign in to comment.