Merge pull request #3758 from Icinga/fix/ldap-group-members-not-found-3650

Fix LDAP group members not found
This commit is contained in:
Johannes Meyer 2019-04-23 15:02:16 +02:00 committed by GitHub
commit 1c0a70d152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 0 deletions

View File

@ -3,6 +3,7 @@
namespace Icinga\Protocol\Ldap;
use Icinga\Data\Filter\Filter;
use LogicException;
use Icinga\Data\SimpleQuery;
@ -183,6 +184,37 @@ class LdapQuery extends SimpleQuery
return parent::from($target, $fields);
}
public function where($condition, $value = null)
{
$this->addFilter(Filter::expression($condition, '=', $value));
return $this;
}
public function addFilter(Filter $filter)
{
$this->makeCaseInsensitive($filter);
return parent::addFilter($filter);
}
public function setFilter(Filter $filter)
{
$this->makeCaseInsensitive($filter);
return parent::setFilter($filter);
}
protected function makeCaseInsensitive(Filter $filter)
{
if ($filter->isExpression()) {
/** @var \Icinga\Data\Filter\FilterExpression $filter */
$filter->setCaseSensitive(false);
} else {
/** @var \Icinga\Data\Filter\FilterChain $filter */
foreach ($filter->filters() as $subFilter) {
$this->makeCaseInsensitive($subFilter);
}
}
}
/**
* Fetch result as tree
*