From: cajus Date: Wed, 28 Oct 2009 18:05:40 +0000 (+0000) Subject: Update ldap filter to handle empty object storage X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c11862e8ac5e68d71480bccbb0de346a01086930;p=gosa.git Update ldap filter to handle empty object storage git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14694 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_filterLDAP.inc b/gosa-core/include/class_filterLDAP.inc index 5a6701d65..e929bee90 100644 --- a/gosa-core/include/class_filterLDAP.inc +++ b/gosa-core/include/class_filterLDAP.inc @@ -24,6 +24,7 @@ class filterLDAP { if (!is_array($objectStorage)) { $objectStorage= array($objectStorage); } + $method= empty($objectStorage)?"ls":"search"; // Initialize search bases $bases= array(); @@ -69,7 +70,6 @@ class filterLDAP { } // Switch to new base and search - $ldap->cd($base); if (is_array($dnFilters)){ $dnFilter= "(|"; foreach ($dnFilters as $df) { @@ -79,7 +79,12 @@ class filterLDAP { } else { $dnFilter= ""; } - $ldap->search ("(&$filter$dnFilter)", $attributes); + $ldap->cd($base); + if ($method == "ls") { + $ldap->ls("(&$filter$dnFilter)", $base, $attributes); + } else { + $ldap->search("(&$filter$dnFilter)", $attributes); + } // Check for size limit exceeded messages for GUI feedback if (preg_match("/size limit/i", $ldap->get_error())){