mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-01-27 00:33:34 +00:00
added $c->disable_caldav_proxy_propfind_collections option - it is very useful if your client not uses the "calendar-proxy-read" and "calendar-proxy-write" resources returned by PROPFIND for each principal (http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk/doc/Extensions/caldav-proxy.txt). The main reason to disable these resources is that it is EXTREMELY expensive to create them (especially on servers with lot of users who share their collections) and most clients will never use them (or use this functionality by explicitly asking for these resources using expand-property REPORT, which will work regardness the value of this option)
supported values:
false/unset => keep these resource active
true => never show these resources
array('User-Agent'=>'#regex1#', 'X-Client'=>'#regex2#') => if a client sends "User-Agent" header which matches the regex1 OR "X-Client" header which matches regex2 then do not show these resources
This commit is contained in:
parent
6229409717
commit
c32a288385
@ -139,25 +139,25 @@ function get_collection_contents( $depth, $collection, $parent_path = null ) {
|
||||
array_change_key_case(apache_request_headers(), CASE_LOWER),
|
||||
array_change_key_case($c->hide_bound, CASE_LOWER),
|
||||
'compare_val_with_re'))) ) ) ) {
|
||||
$qry = new AwlQuery('SELECT * FROM dav_binding WHERE dav_binding.parent_container = :this_dav_name ORDER BY bind_id',
|
||||
array(':this_dav_name' => $bound_from));
|
||||
if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows() > 0 ) {
|
||||
while( $binding = $qry->Fetch() ) {
|
||||
$resource = new DAVResource($binding->dav_name);
|
||||
if ( $resource->IsExternal() ) {
|
||||
require_once("external-fetch.php");
|
||||
update_external ( $resource );
|
||||
}
|
||||
if ( $resource->HavePrivilegeTo('DAV::read', false) ) {
|
||||
$resource->set_bind_location( str_replace($bound_from,$bound_to,$binding->dav_name));
|
||||
$responses[] = $resource->RenderAsXML($property_list, $reply);
|
||||
if ( $depth > 0 ) {
|
||||
$responses = array_merge($responses, get_collection_contents( $depth - 1, $resource, $binding->dav_name ) );
|
||||
$qry = new AwlQuery('SELECT * FROM dav_binding WHERE dav_binding.parent_container = :this_dav_name ORDER BY bind_id',
|
||||
array(':this_dav_name' => $bound_from));
|
||||
if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows() > 0 ) {
|
||||
while( $binding = $qry->Fetch() ) {
|
||||
$resource = new DAVResource($binding->dav_name);
|
||||
if ( $resource->IsExternal() ) {
|
||||
require_once("external-fetch.php");
|
||||
update_external ( $resource );
|
||||
}
|
||||
if ( $resource->HavePrivilegeTo('DAV::read', false) ) {
|
||||
$resource->set_bind_location( str_replace($bound_from,$bound_to,$binding->dav_name));
|
||||
$responses[] = $resource->RenderAsXML($property_list, $reply);
|
||||
if ( $depth > 0 ) {
|
||||
$responses = array_merge($responses, get_collection_contents( $depth - 1, $resource, $binding->dav_name ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT principal.*, collection.*, \'collection\' AS type ';
|
||||
$sql .= 'FROM collection LEFT JOIN principal USING (user_no) ';
|
||||
@ -182,7 +182,14 @@ function get_collection_contents( $depth, $collection, $parent_path = null ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( (!isset($c->disable_caldav_proxy) || $c->disable_caldav_proxy == false) && $collection->IsPrincipal() ) {
|
||||
if ( !( (isset($c->disable_caldav_proxy) && $c->disable_caldav_proxy != false) ||
|
||||
(isset($c->disable_caldav_proxy_propfind_collections) && (
|
||||
((is_bool($c->disable_caldav_proxy_propfind_collections) || is_numeric($c->disable_caldav_proxy_propfind_collections)) && $c->disable_caldav_proxy_propfind_collections != false) ||
|
||||
(is_string($c->disable_caldav_proxy_propfind_collections) && preg_match($c->disable_caldav_proxy_propfind_collections, $_SERVER['HTTP_USER_AGENT'])) ||
|
||||
(is_array($c->disable_caldav_proxy_propfind_collections) && count(array_uintersect_assoc(
|
||||
array_change_key_case(apache_request_headers(), CASE_LOWER),
|
||||
array_change_key_case($c->disable_caldav_proxy_propfind_collections, CASE_LOWER),
|
||||
'compare_val_with_re')))) ) ) && $collection->IsPrincipal() ) {
|
||||
// Caldav Proxy: 5.1 par. 2: Add child resources calendar-proxy-(read|write)
|
||||
dbg_error_log('PROPFIND','Adding calendar-proxy-read and write. Path: %s', $bound_from );
|
||||
$response = add_proxy_response('read', $bound_from );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user