remove unneeded empty search attribute values, fixes #12086

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2018-10-29 13:21:02 +01:00
parent 0c89dd2197
commit d47e1513bc
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
2 changed files with 13 additions and 1 deletions

View File

@ -197,6 +197,13 @@ class Manager {
);
}
// remove possible empty attributes
$attributes = array_values(
array_filter($attributes, function ($attributeName) {
return !empty($attributeName);
})
);
return $attributes;
}

View File

@ -256,12 +256,17 @@ class ManagerTest extends \Test\TestCase {
$manager->setLdapAccess($access);
$connection = $access->getConnection();
$connection->setConfiguration(['ldapEmailAttribute' => 'mail', 'ldapUserAvatarRule' => 'default']);
$connection->setConfiguration([
'ldapEmailAttribute' => 'mail',
'ldapUserAvatarRule' => 'default',
'ldapQuotaAttribute' => '',
]);
$attributes = $manager->getAttributes($minimal);
$this->assertTrue(in_array('dn', $attributes));
$this->assertTrue(in_array($access->getConnection()->ldapEmailAttribute, $attributes));
$this->assertFalse(in_array('', $attributes));
$this->assertSame(!$minimal, in_array('jpegphoto', $attributes));
$this->assertSame(!$minimal, in_array('thumbnailphoto', $attributes));
}