diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-09-14 11:34:21 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-09-26 11:55:42 +0200 |
commit | 83602225549d1df67403a333ed4a53e8a02d1619 (patch) | |
tree | 57e7808350d19ca5fcb1889d24ab8f1cd8d298b8 /apps | |
parent | d884370844c7f807b10aa09e63cb814927011572 (diff) | |
download | nextcloud-server-83602225549d1df67403a333ed4a53e8a02d1619.tar.gz nextcloud-server-83602225549d1df67403a333ed4a53e8a02d1619.zip |
fix public calendars
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 17 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/Calendar.php | 4 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/Publishing/PublishPlugin.php | 2 |
3 files changed, 22 insertions, 1 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 7b8c1be51f5..34bc0b3c8be 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -1649,6 +1649,23 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } /** + * @param \OCA\DAV\CalDAV\Calendar $calendar + * @return string + */ + public function getPublishToken($calendar) { + $query = $this->db->getQueryBuilder(); + $result = $query->select('publicuri') + ->from('dav_shares') + ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) + ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))) + ->execute(); + + $row = $result->fetch(); + $result->closeCursor(); + return reset($row); + } + + /** * @param int $resourceId * @param array $acl * @return array diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index 5fe9be8957d..17cc4780f78 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -267,6 +267,10 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { return $this->caldavBackend->getPublishStatus($this); } + function getPublishToken() { + return $this->caldavBackend->getPublishToken($this); + } + private function canWrite() { if (isset($this->calendarInfo['{http://owncloud.org/ns}read-only'])) { return !$this->calendarInfo['{http://owncloud.org/ns}read-only']; diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php index 0e5377d30c1..aaa2868a86d 100644 --- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php +++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php @@ -97,7 +97,7 @@ class PublishPlugin extends ServerPlugin { $propFind->handle('{'.self::NS_CALENDARSERVER.'}publish-url', function () use ($node) { if ($node->getPublishStatus()) { // We return the publish-url only if the calendar is published. - $token = $node->getName(); + $token = $node->getPublishToken(); $publishUrl = $this->urlGenerator->getAbsoluteURL($this->server->getBaseUri().'public-calendars/').$token; return new Publisher($publishUrl, true); |