added $c->hide_bound configuration options - it is very useful if you use iOS (which not supports delegation) in combination with other software which supports degation ... simply use case is: bind all collections you want to see on iOS (emulation of delegation) and then hide these collections from other clients with real delegation support

supported values:
false/unset => always show bound collections
true	=> never show bound collections
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 all bound collections are hidden
This commit is contained in:
Ján Máté 2014-05-14 13:46:00 +02:00
parent 7be6aee280
commit 6229409717

View File

@ -132,6 +132,13 @@ function get_collection_contents( $depth, $collection, $parent_path = null ) {
$sql .= 'ORDER BY usr.user_no';
}
else {
if ( !( isset($c->hide_bound) && (
((is_bool($c->hide_bound) || is_numeric($c->hide_bound)) && $c->hide_bound != false) ||
(is_string($c->hide_bound) && preg_match($c->hide_bound, $_SERVER['HTTP_USER_AGENT'])) ||
(is_array($c->hide_bound) && count(array_uintersect_assoc(
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 ) {
@ -150,6 +157,7 @@ function get_collection_contents( $depth, $collection, $parent_path = null ) {
}
}
}
}
$sql = 'SELECT principal.*, collection.*, \'collection\' AS type ';
$sql .= 'FROM collection LEFT JOIN principal USING (user_no) ';