summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-07-08 16:52:20 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-09-26 11:55:36 +0200
commite7085aab387c90f6b5a7f8352864cc0d04bb96d1 (patch)
treeb815396352de0a75083098ca4a8ce0d125fef42f /apps/dav/lib/CalDAV
parent90ab6e4fd9b25a8f031f812d46915e8413483be2 (diff)
downloadnextcloud-server-e7085aab387c90f6b5a7f8352864cc0d04bb96d1.tar.gz
nextcloud-server-e7085aab387c90f6b5a7f8352864cc0d04bb96d1.zip
Allow not-authenticated access to specific urls
Diffstat (limited to 'apps/dav/lib/CalDAV')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php1
-rw-r--r--apps/dav/lib/CalDAV/Calendar.php13
2 files changed, 13 insertions, 1 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index 303e97fd308..a134cba348e 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -339,6 +339,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'],
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
+ '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
];
foreach($this->propertyMap as $xmlName=>$dbName) {
diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php
index 6a811149e26..bda671dfa43 100644
--- a/apps/dav/lib/CalDAV/Calendar.php
+++ b/apps/dav/lib/CalDAV/Calendar.php
@@ -90,7 +90,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
}
/**
- * @return str
+ * @return string
*/
public function getPrincipalURI() {
return $this->calendarInfo['principaluri'];
@@ -124,6 +124,13 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
];
}
}
+ if ($this->isPublic()) {
+ $acl[] = [
+ 'privilege' => '{DAV:}read',
+ 'principal' => 'principals/system/public',
+ 'protected' => true,
+ ];
+ }
/** @var CalDavBackend $calDavBackend */
$calDavBackend = $this->caldavBackend;
@@ -264,6 +271,10 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
return true;
}
+ private function isPublic() {
+ return isset($this->calendarInfo['{http://owncloud.org/ns}public']);
+ }
+
private function isShared() {
return isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal']);
}