Allow LDAP queries without objectClass filter

This commit is contained in:
Thomas Gelf 2014-03-21 10:31:12 +00:00
parent f24e5eaa8a
commit fea7e8993b
1 changed files with 7 additions and 3 deletions

View File

@ -313,8 +313,8 @@ class Query
protected function render()
{
$parts = array();
if ($this->filters['objectClass'] === null) {
throw new Exception('Object class is mandatory');
if (! isset($this->filters['objectClass']) || $this->filters['objectClass'] === null) {
// throw new Exception('Object class is mandatory');
}
foreach ($this->filters as $key => $value) {
$parts[] = sprintf(
@ -323,7 +323,11 @@ class Query
LdapUtils::quoteForSearch($value, true)
);
}
return '(&(' . implode(')(', $parts) . '))';
if (count($parts) > 1) {
return '(&(' . implode(')(', $parts) . '))';
} else {
return '(' . $parts[0] . ')';
}
}
/**