summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV/Calendar.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/CalDAV/Calendar.php')
-rw-r--r--apps/dav/lib/CalDAV/Calendar.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php
index 821a71babb1..3fbcd87acc0 100644
--- a/apps/dav/lib/CalDAV/Calendar.php
+++ b/apps/dav/lib/CalDAV/Calendar.php
@@ -89,6 +89,13 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
return $this->calendarInfo['id'];
}
+ /**
+ * @return string
+ */
+ public function getPrincipalURI() {
+ return $this->calendarInfo['principaluri'];
+ }
+
function getACL() {
$acl = [
[
@@ -117,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;
@@ -236,6 +250,23 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
return $uris;
}
+ /**
+ * @param boolean $value
+ * @return string|null
+ */
+ function setPublishStatus($value) {
+ $publicUri = $this->caldavBackend->setPublishStatus($value, $this);
+ $this->calendarInfo['publicuri'] = $publicUri;
+ return $publicUri;
+ }
+
+ /**
+ * @return mixed $value
+ */
+ function getPublishStatus() {
+ return $this->caldavBackend->getPublishStatus($this);
+ }
+
private function canWrite() {
if (isset($this->calendarInfo['{http://owncloud.org/ns}read-only'])) {
return !$this->calendarInfo['{http://owncloud.org/ns}read-only'];
@@ -243,8 +274,16 @@ 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']);
}
+ public function isSubscription() {
+ return isset($this->calendarInfo['{http://calendarserver.org/ns/}source']);
+ }
+
}