mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-11-29 08:56:03 +00:00
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:
1 parent
7be6aee280
commit
6229409717
1 file changed
+8
@@ -132,6 +132,13 @@ function get_collection_contents( $depth, $collection, $parent_path = null ) {
|
|||||||
$sql .= 'ORDER BY usr.user_no';
|
$sql .= 'ORDER BY usr.user_no';
|
||||||
}
|
}
|
||||||
else {
|
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',
|
$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));
|
array(':this_dav_name' => $bound_from));
|
||||||
if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows() > 0 ) {
|
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 = 'SELECT principal.*, collection.*, \'collection\' AS type ';
|
||||||
$sql .= 'FROM collection LEFT JOIN principal USING (user_no) ';
|
$sql .= 'FROM collection LEFT JOIN principal USING (user_no) ';
|
||||||
|
|||||||
Reference in new issue
Block a user