summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV/Schedule
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2018-10-16 14:39:52 +0200
committerGeorg Ehrke <developer@georgehrke.com>2018-10-22 15:48:18 +0200
commit10f0296ad6e51be99b36e2855e260f9092f61175 (patch)
tree7c5ee07e4468e6da4f578dc0ecb66e3d2ed3cc42 /apps/dav/lib/CalDAV/Schedule
parent325e366b581372b9f07a4bd00b7f874283c9f1f5 (diff)
downloadnextcloud-server-10f0296ad6e51be99b36e2855e260f9092f61175.tar.gz
nextcloud-server-10f0296ad6e51be99b36e2855e260f9092f61175.zip
overwrite Sabre/DAV's handler for calendar-user-type to report correct user type
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.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php
index b3f7232c2fe..227a1c11eda 100644
--- a/apps/dav/lib/CalDAV/Schedule/Plugin.php
+++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php
@@ -50,6 +50,31 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
}
/**
+ * This method handler is invoked during fetching of properties.
+ *
+ * We use this event to add calendar-auto-schedule-specific properties.
+ *
+ * @param PropFind $propFind
+ * @param INode $node
+ * @return void
+ */
+ function propFind(PropFind $propFind, INode $node) {
+ // overwrite Sabre/Dav's implementation
+ $propFind->handle('{' . self::NS_CALDAV . '}calendar-user-type', function() use ($node) {
+ $calendarUserType = '{' . self::NS_CALDAV . '}calendar-user-type';
+ $props = $node->getProperties([$calendarUserType]);
+
+ if (isset($props[$calendarUserType])) {
+ return $props[$calendarUserType];
+ }
+
+ return 'INDIVIDUAL';
+ });
+
+ parent::propFind($propFind, $node);
+ }
+
+ /**
* Returns a list of addresses that are associated with a principal.
*
* @param string $principal