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 ee309ca
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/dav/lib/CalDAV/CalendarHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Sabre\CalDAV\Schedule\Outbox;
use Sabre\CalDAV\Subscriptions\Subscription;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\MkCol;

class CalendarHome extends \Sabre\CalDAV\CalendarHome {

Expand All @@ -52,6 +53,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 \Sabre\Dav\Exception\MethodNotAllowed('The resource you tried to create is a reserved name');
}

parent::createExtendedCollection($name, $mkCol);
}

/**
* @inheritdoc
*/
Expand Down

0 comments on commit ee309ca

Please sign in to comment.