Commit ae887ffd authored by Côme Chilliet's avatar Côme Chilliet
Browse files

feat(management) Put back minimal size limit support

issue #5135
parent e6b7807a
......@@ -42,7 +42,7 @@ class objects
*
* \return The list of objects as an associative array (keys are dns)
*/
static function ls ($types, $attrs = NULL, $ou = NULL, $filter = '', $checkAcl = FALSE, $scope = 'subtree', $templateSearch = FALSE)
static function ls ($types, $attrs = NULL, $ou = NULL, $filter = '', $checkAcl = FALSE, $scope = 'subtree', $templateSearch = FALSE, $sizeLimit = FALSE)
{
global $ui, $config;
......@@ -105,7 +105,7 @@ class objects
}
try {
$ldap = static::search($types, $search_attrs, $ou, $filter, $checkAcl, $scope, $templateSearch, $partialFilterAcls);
$ldap = static::search($types, $search_attrs, $ou, $filter, $checkAcl, $scope, $templateSearch, $partialFilterAcls, $sizeLimit);
} catch (NonExistingBranchException $e) {
return array();
}
......@@ -181,7 +181,7 @@ class objects
return $ldap->count();
}
private static function search ($types, $search_attrs, $ou = NULL, $filter = '', $checkAcl = FALSE, $scope = 'subtree', $templateSearch = FALSE, &$partialFilterAcls = array())
private static function search ($types, $search_attrs, $ou = NULL, $filter = '', $checkAcl = FALSE, $scope = 'subtree', $templateSearch = FALSE, &$partialFilterAcls = array(), $sizeLimit = FALSE)
{
global $config, $ui;
......@@ -215,7 +215,7 @@ class objects
throw new EmptyFilterException();
}
$ldap = $config->get_ldap_link();
$ldap = $config->get_ldap_link($sizeLimit);
if (!$ldap->dn_exists($ou)) {
throw new NonExistingBranchException();
}
......@@ -259,7 +259,12 @@ class objects
$ldap->cd($ou);
$ldap->search($filter, $search_attrs, $scope);
if (!$ldap->success()) {
throw new LDAPFailureException($ldap->get_error());
if ($sizeLimit && preg_match('/size limit/i', $ldap->get_error())) {
// Check for size limit exceeded messages for GUI feedback
$ui->getSizeLimitHandler()->setLimitExceeded();
} else {
throw new LDAPFailureException($ldap->get_error());
}
}
return $ldap;
}
......
......@@ -184,7 +184,7 @@ class managementFilter
$filter = '(&'.implode('', $typeElementFilters).')';
}
$ldapEntries = objects::ls($type, $attrsAsked, $searchBase, $filter, TRUE, $this->scope);
$ldapEntries = objects::ls($type, $attrsAsked, $searchBase, $filter, TRUE, $this->scope, FALSE, TRUE);
$objectTypeCount[$type] = count($ldapEntries);
foreach ($ldapEntries as $dn => $entry) {
......
  • SonarQube analysis reported 2 issues

    • 2 major

    Note: The following issues were found on lines that were not modified in the commit. Because these issues can't be reported as line comments, they are summarized here:

    1. This function "__construct" has 156 lines, which is greater than the 150 lines authorized. Split it into smaller functions. 📘
    2. Merge this if statement with the enclosing one. 📘
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment