summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2017-05-01 14:37:24 +0200
committerGeorg Ehrke <developer@georgehrke.com>2017-05-08 12:09:15 +0200
commit255442f2817d2504496ca6f60787933c3f064742 (patch)
treeeb48ff7b7c589a7298850237eb8a0369d1e6c989 /apps/dav
parent2152d5f1f610a40539f11e91318ab27c54400ef3 (diff)
downloadnextcloud-server-255442f2817d2504496ca6f60787933c3f064742.tar.gz
nextcloud-server-255442f2817d2504496ca6f60787933c3f064742.zip
fix PROPPATCH requests to read-only shared calendars
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CalDAV/Calendar.php9
-rw-r--r--apps/dav/tests/unit/CalDAV/CalendarTest.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/PublicCalendarTest.php2
3 files changed, 11 insertions, 2 deletions
diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php
index a216e4e078b..9c56398b14c 100644
--- a/apps/dav/lib/CalDAV/Calendar.php
+++ b/apps/dav/lib/CalDAV/Calendar.php
@@ -145,11 +145,16 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
];
}
- if ($this->isShared()) {
+ $acl = $this->caldavBackend->applyShareAcl($this->getResourceId(), $acl);
+
+ if (!$this->isShared()) {
return $acl;
}
- return $this->caldavBackend->applyShareAcl($this->getResourceId(), $acl);
+ $allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/public'];
+ return array_filter($acl, function($rule) use ($allowedPrincipals) {
+ return in_array($rule['principal'], $allowedPrincipals);
+ });
}
public function getChildACL() {
diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php
index 4ede886d31e..cf295f01065 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php
@@ -246,6 +246,7 @@ class CalendarTest extends TestCase {
]);
$backend->expects($this->any())->method('getCalendarObject')
->willReturn($calObject2)->with(666, 'event-2');
+ $backend->expects($this->any())->method('applyShareAcl')->willReturnArgument(1);
$calendarInfo = [
'principaluri' => 'user2',
@@ -333,6 +334,7 @@ EOD;
]);
$backend->expects($this->any())->method('getCalendarObject')
->willReturn($calObject1)->with(666, 'event-1');
+ $backend->expects($this->any())->method('applyShareAcl')->willReturnArgument(1);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => $isShared ? 'user1' : 'user2',
diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php
index 6b2bf58d392..03cbf71d6ca 100644
--- a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php
+++ b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php
@@ -51,6 +51,7 @@ class PublicCalendarTest extends CalendarTest {
]);
$backend->expects($this->any())->method('getCalendarObject')
->willReturn($calObject2)->with(666, 'event-2');
+ $backend->expects($this->any())->method('applyShareAcl')->willReturnArgument(1);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user2',
@@ -135,6 +136,7 @@ EOD;
]);
$backend->expects($this->any())->method('getCalendarObject')
->willReturn($calObject1)->with(666, 'event-1');
+ $backend->expects($this->any())->method('applyShareAcl')->willReturnArgument(1);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',