added LDAP config to set filter for finding user attributes (#877)
This commit is contained in:
@@ -570,6 +570,7 @@ class Configuration implements ConfigurationInterface
|
||||
->thenInvalid('The ldap.user.filter must be enclosed by a matching number of parentheses "()" and must NOT contain a "%%s" replacer')
|
||||
->end()
|
||||
->end()
|
||||
->scalarNode('attributesFilter')->defaultValue('(objectClass=*)')->end()
|
||||
->scalarNode('usernameAttribute')->defaultValue('uid')->end()
|
||||
->arrayNode('attributes')
|
||||
->defaultValue([])
|
||||
|
||||
@@ -106,7 +106,6 @@ class LdapManager
|
||||
public function updateUser(User $user)
|
||||
{
|
||||
$baseDn = $user->getPreferenceValue('ldap.dn');
|
||||
$filter = '(objectClass=*)';
|
||||
|
||||
if (null === $baseDn) {
|
||||
throw new LdapDriverException('This account is not a registered LDAP user');
|
||||
@@ -119,7 +118,7 @@ class LdapManager
|
||||
}
|
||||
$user->setPreferenceValue('ldap.dn', $baseDn);
|
||||
|
||||
$entries = $this->driver->search($baseDn, $filter);
|
||||
$entries = $this->driver->search($baseDn, $this->params['attributesFilter']);
|
||||
|
||||
if ($entries['count'] > 1) {
|
||||
throw new LdapDriverException('This search must only return a single user');
|
||||
|
||||
Reference in New Issue
Block a user