overwrite Sabre/DAV's handler for calendar-user-type to report correct user type

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
Georg Ehrke 2018-10-16 14:39:52 +02:00
parent 325e366b58
commit 10f0296ad6
No known key found for this signature in database
GPG Key ID: 9D98FD9380A1CB43
1 changed files with 25 additions and 0 deletions

View File

@ -49,6 +49,31 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
$server->on('propFind', [$this, 'propFindDefaultCalendarUrl'], 90);
}
/**
* 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.
*