add DAVResource->IsProxyCollection()

This commit is contained in:
Florian Schlichting 2018-01-08 23:02:03 +01:00
parent a7ba436f2f
commit 83e9106160

View File

@ -265,6 +265,8 @@ class DAVResource
}
else if ( $this->_is_proxy_request ) {
$this->resourcetypes = $this->collection->resourcetypes;
preg_match( '#^/[^/]+/calendar-proxy-(read|write)/?[^/]*$#', $this->dav_name, $matches );
$this->proxy_type = $matches[1];
}
if ( isset($this->collection->dav_displayname) ) $this->collection->displayname = $this->collection->dav_displayname;
}
@ -1103,6 +1105,18 @@ EOQRY;
}
/**
* Checks whether this resource is a proxy collection
* @param string $type The type of proxy collection, 'read', 'write' or 'any'
*/
function IsProxyCollection( $type = 'any' ) {
if ( $this->_is_proxy_request ) {
return ($type == 'any' || $type == $this->proxy_type);
}
return false;
}
/**
* Checks whether this resource is a scheduling inbox/outbox collection
* @param string $type The type of scheduling collection, 'inbox', 'outbox' or 'any'