LdapQuery: Make all applied filters case-insensitive
LDAP peforms case-insensitive checks by default so do we now. fixes #3650
This commit is contained in:
parent
57abdc8baa
commit
a2d30a100c
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
namespace Icinga\Protocol\Ldap;
|
namespace Icinga\Protocol\Ldap;
|
||||||
|
|
||||||
|
use Icinga\Data\Filter\Filter;
|
||||||
use LogicException;
|
use LogicException;
|
||||||
use Icinga\Data\SimpleQuery;
|
use Icinga\Data\SimpleQuery;
|
||||||
|
|
||||||
|
@ -183,6 +184,37 @@ class LdapQuery extends SimpleQuery
|
||||||
return parent::from($target, $fields);
|
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
|
* Fetch result as tree
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue