From 6a2a5465cfbe9d79e83414212d2eb6753fb19480 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 26 Jul 2019 15:04:58 +0200 Subject: [PATCH] fix CUType reporting Signed-off-by: Georg Ehrke --- apps/dav/lib/CalDAV/Schedule/Plugin.php | 29 +++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php index 1b262efd4f..afdd473aee 100644 --- a/apps/dav/lib/CalDAV/Schedule/Plugin.php +++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php @@ -27,6 +27,7 @@ namespace OCA\DAV\CalDAV\Schedule; use OCA\DAV\CalDAV\CalDavBackend; use OCA\DAV\CalDAV\CalendarHome; use Sabre\DAV\INode; +use Sabre\DAV\IProperties; use Sabre\DAV\PropFind; use Sabre\DAV\Server; use Sabre\DAV\Xml\Property\LocalHref; @@ -55,19 +56,23 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin { * @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); + + if ($node instanceof IPrincipal) { + // overwrite Sabre/Dav's implementation + $propFind->handle('{' . self::NS_CALDAV . '}calendar-user-type', function () use ($node) { + if ($node instanceof IProperties) { + $calendarUserType = '{' . self::NS_CALDAV . '}calendar-user-type'; + $props = $node->getProperties([$calendarUserType]); + + if (isset($props[$calendarUserType])) { + return $props[$calendarUserType]; + } + } + + return 'INDIVIDUAL'; + }); + } } /**