server = $server; $this->server->on('propFind', $this->propFind(...)); } public function propFind(PropFind $propFind, INode $node): void { if ($node instanceof Calendar) { $propFind->handle('{' . self::NS_CALENDARSERVER . '}allowed-sharing-modes', function () use ($node) { $canShare = (!$node->isSubscription() && $node->canWrite()); $canPublish = (!$node->isSubscription() && $node->canWrite()); if ($this->config->getValueBool('dav', 'limitAddressBookAndCalendarSharingToOwner')) { $canShare = $canShare && ($node->getOwner() === $node->getPrincipalURI()); $canPublish = $canPublish && ($node->getOwner() === $node->getPrincipalURI()); } if (!$this->config->getValueBool('core', 'shareapi_allow_links', true)) { $canPublish = false; } return new AllowedSharingModes($canShare, $canPublish); }); } } }