diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-08 12:46:09 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-18 11:49:16 +0100 |
commit | 981c73000cce96276d2e9db899162f31226b146f (patch) | |
tree | a34920306ddcacd0a711131552513b65c884ddf3 | |
parent | c9187cc82084e5b140f52cbaefa7d71c70f989a0 (diff) | |
download | nextcloud-server-981c73000cce96276d2e9db899162f31226b146f.tar.gz nextcloud-server-981c73000cce96276d2e9db899162f31226b146f.zip |
Prevent deletion of birthday calendar
-rw-r--r-- | apps/dav/lib/caldav/birthdayservice.php | 6 | ||||
-rw-r--r-- | apps/dav/lib/caldav/calendar.php | 4 | ||||
-rw-r--r-- | apps/dav/tests/unit/caldav/calendartest.php | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/apps/dav/lib/caldav/birthdayservice.php b/apps/dav/lib/caldav/birthdayservice.php index 624c2086947..5a0dfb69925 100644 --- a/apps/dav/lib/caldav/birthdayservice.php +++ b/apps/dav/lib/caldav/birthdayservice.php @@ -140,16 +140,10 @@ class BirthdayService { $date ); $vEvent->DTEND['VALUE'] = 'DATE'; -// $lm = new \DateTime('@' . $this->lastModified()); -// $lm->setTimeZone(new \DateTimeZone('UTC')); -// $vEvent->DTSTAMP->setDateTime($lm); $vEvent->{'UID'} = $doc->UID; $vEvent->{'RRULE'} = 'FREQ=YEARLY'; $vEvent->{'SUMMARY'} = $title . ' (' . $date->format('Y') . ')'; $vEvent->{'TRANSP'} = 'TRANSPARENT'; -// $appInfo = \OCP\App::getAppInfo('contacts'); -// $appVersion = \OCP\App::getAppVersion('contacts'); -// $vCal->PRODID = '-//ownCloud//NONSGML ' . $appInfo['name'] . ' ' . $appVersion . '//EN'; $vCal->add($vEvent); return $vCal; } diff --git a/apps/dav/lib/caldav/calendar.php b/apps/dav/lib/caldav/calendar.php index 8ed5b6563d0..6b34d570eb3 100644 --- a/apps/dav/lib/caldav/calendar.php +++ b/apps/dav/lib/caldav/calendar.php @@ -80,6 +80,10 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { } function delete() { + if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI) { + throw new Forbidden(); + } + if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) { $principal = 'principal:' . parent::getOwner(); $shares = $this->getShares(); diff --git a/apps/dav/tests/unit/caldav/calendartest.php b/apps/dav/tests/unit/caldav/calendartest.php index 93b3f4bff8c..4a3c94e8aba 100644 --- a/apps/dav/tests/unit/caldav/calendartest.php +++ b/apps/dav/tests/unit/caldav/calendartest.php @@ -37,7 +37,8 @@ class CalendarTest extends TestCase { $calendarInfo = [ '{http://owncloud.org/ns}owner-principal' => 'user1', 'principaluri' => 'user2', - 'id' => 666 + 'id' => 666, + 'uri' => 'cal', ]; $c = new Calendar($backend, $calendarInfo); $c->delete(); @@ -56,7 +57,8 @@ class CalendarTest extends TestCase { $calendarInfo = [ '{http://owncloud.org/ns}owner-principal' => 'user1', 'principaluri' => 'user2', - 'id' => 666 + 'id' => 666, + 'uri' => 'cal', ]; $c = new Calendar($backend, $calendarInfo); $c->delete(); |