Merge pull request #4621 from nextcloud/fix_readonly_shared_calendar_proppatch
fix PROPPATCH requests to read-only shared calendars
This commit is contained in:
commit
2d707fdfb5
3 changed files with 11 additions and 2 deletions
|
@ -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() {
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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…
Reference in a new issue