summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV/Schedule
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2018-05-28 20:12:13 +0200
committerGeorg Ehrke <developer@georgehrke.com>2018-06-25 04:58:07 +0200
commit2da510af0b537e3bef7d0563eff828bade51fcbd (patch)
treea5e5d3ec9884ba47853bf87577a546110a718cd2 /apps/dav/lib/CalDAV/Schedule
parent29b777e7d1d26a3b75b0aabcca394170e6043939 (diff)
downloadnextcloud-server-2da510af0b537e3bef7d0563eff828bade51fcbd.tar.gz
nextcloud-server-2da510af0b537e3bef7d0563eff828bade51fcbd.zip
add resource / room principals
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib/CalDAV/Schedule')
-rw-r--r--apps/dav/lib/CalDAV/Schedule/Plugin.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php
index faf495a4de6..b3f7232c2fe 100644
--- a/apps/dav/lib/CalDAV/Schedule/Plugin.php
+++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php
@@ -80,20 +80,32 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
$principalUrl = $node->getPrincipalUrl();
$calendarHomePath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl);
-
if (!$calendarHomePath) {
return null;
}
+ if (strpos($principalUrl, 'principals/users') === 0) {
+ $uri = CalDavBackend::PERSONAL_CALENDAR_URI;
+ $displayname = CalDavBackend::PERSONAL_CALENDAR_NAME;
+ } elseif (strpos($principalUrl, 'principals/calendar-resources') === 0 ||
+ strpos($principalUrl, 'principals/calendar-rooms') === 0) {
+ $uri = CalDavBackend::RESOURCE_BOOKING_CALENDAR_URI;
+ $displayname = CalDavBackend::RESOURCE_BOOKING_CALENDAR_NAME;
+ } else {
+ // How did we end up here?
+ // TODO - throw exception or just ignore?
+ return null;
+ }
+
/** @var CalendarHome $calendarHome */
$calendarHome = $this->server->tree->getNodeForPath($calendarHomePath);
- if (!$calendarHome->childExists(CalDavBackend::PERSONAL_CALENDAR_URI)) {
- $calendarHome->getCalDAVBackend()->createCalendar($principalUrl, CalDavBackend::PERSONAL_CALENDAR_URI, [
- '{DAV:}displayname' => CalDavBackend::PERSONAL_CALENDAR_NAME,
+ if (!$calendarHome->childExists($uri)) {
+ $calendarHome->getCalDAVBackend()->createCalendar($principalUrl, $uri, [
+ '{DAV:}displayname' => $displayname,
]);
}
- $result = $this->server->getPropertiesForPath($calendarHomePath . '/' . CalDavBackend::PERSONAL_CALENDAR_URI, [], 1);
+ $result = $this->server->getPropertiesForPath($calendarHomePath . '/' . $uri, [], 1);
if (empty($result)) {
return null;
}