Browse Source

fix PROPPATCH requests to read-only shared calendars

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
tags/v12.0.0beta2
Georg Ehrke 7 years ago
parent
commit
255442f281
No account linked to committer's email address

+ 7
- 2
apps/dav/lib/CalDAV/Calendar.php View File

@@ -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() {

+ 2
- 0
apps/dav/tests/unit/CalDAV/CalendarTest.php View File

@@ -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',

+ 2
- 0
apps/dav/tests/unit/CalDAV/PublicCalendarTest.php View File

@@ -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',

Loading…
Cancel
Save