addType('principaluri', Types::STRING); $this->addType('uri', Types::STRING); $this->addType('color', Types::STRING); $this->addType('displayName', Types::STRING); $this->addType('permissions', Types::INTEGER); $this->addType('syncToken', Types::INTEGER); $this->addType('remoteUrl', Types::STRING); $this->addType('token', Types::STRING); $this->addType('lastSync', Types::INTEGER); $this->addType('sharedBy', Types::STRING); $this->addType('sharedByDisplayName', Types::STRING); $this->addType('components', Types::STRING); } public function getSyncTokenForSabre(): string { return 'http://sabre.io/ns/sync/' . $this->getSyncToken(); } public function getSharedByPrincipal(): string { return RemoteUserPrincipalBackend::PRINCIPAL_PREFIX . '/' . base64_encode($this->getSharedBy()); } public function getSupportedCalendarComponentSet(): SupportedCalendarComponentSet { $components = explode(',', $this->getComponents()); return new SupportedCalendarComponentSet($components); } public function toCalendarInfo(): array { return [ 'id' => $this->getId(), 'uri' => $this->getUri(), 'principaluri' => $this->getPrincipaluri(), 'federated' => 1, '{DAV:}displayname' => $this->getDisplayName(), '{http://sabredav.org/ns}sync-token' => $this->getSyncToken(), '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => $this->getSyncTokenForSabre(), '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => $this->getSupportedCalendarComponentSet(), '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->getSharedByPrincipal(), // TODO: implement read-write sharing '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => 1 ]; } }