Merge pull request #17184 from nextcloud/backport/17174/stable17

[stable17] properly mark birthday calendars as not shareable for now
This commit is contained in:
Roeland Jago Douma 2019-09-18 12:48:42 +02:00 committed by GitHub
commit 33509a9834
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -363,7 +363,11 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
return $this->caldavBackend->getPublishStatus($this); return $this->caldavBackend->getPublishStatus($this);
} }
private function canWrite() { public function canWrite() {
if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI) {
return false;
}
if (isset($this->calendarInfo['{http://owncloud.org/ns}read-only'])) { if (isset($this->calendarInfo['{http://owncloud.org/ns}read-only'])) {
return !$this->calendarInfo['{http://owncloud.org/ns}read-only']; return !$this->calendarInfo['{http://owncloud.org/ns}read-only'];
} }

View file

@ -126,7 +126,10 @@ class PublishPlugin extends ServerPlugin {
}); });
$propFind->handle('{'.self::NS_CALENDARSERVER.'}allowed-sharing-modes', function() use ($node) { $propFind->handle('{'.self::NS_CALENDARSERVER.'}allowed-sharing-modes', function() use ($node) {
return new AllowedSharingModes(!$node->isSubscription(), !$node->isSubscription()); $canShare = (!$node->isSubscription() && $node->canWrite());
$canPublish = (!$node->isSubscription() && $node->canWrite());
return new AllowedSharingModes($canShare, $canPublish);
}); });
} }
} }