Add support for calendar-user-type

This commit is contained in:
Pierre GIRAUD 2017-10-03 11:44:19 +02:00
parent 3bb6cd4479
commit 8e04eb27ae
No known key found for this signature in database
GPG Key ID: 2D3C1FBD8BA59F61

View File

@ -558,6 +558,29 @@ class DAVPrincipal extends Principal
$reply->CalDAVElement($prop, 'calendar-user-address-set', $reply->href($this->user_address_set));
break;
case 'urn:ietf:params:xml:ns:caldav:calendar-user-type':
/**
* See https://tools.ietf.org/html/rfc6638#section-2.4.2
* and https://tools.ietf.org/html/rfc5545#section-3.2.3
*/
$type = 'UNKNOWN';
if ( isset($this->type_id) ) {
switch ( $this->type_id ) {
case 1:
$type = 'INDIVIDUAL';
break;
case 2:
$type = 'RESOURCE';
break;
case 3:
$type = 'GROUP';
break;
// 'ROOM' type is not supported yet
}
}
$reply->CalDAVElement($prop, 'calendar-user-type', $type);
break;
case 'DAV::owner':
// After a careful reading of RFC3744 we see that this must be the principal-URL of the owner
$reply->DAVElement( $prop, 'owner', $reply->href( $this->url ) );