Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
remove unneeded empty search attribute values, fixes #12086
Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz committed Oct 29, 2018
commit 36b21e5e4e6ef27adfefcbb2cfdcd4d8d232e287
7 changes: 7 additions & 0 deletions apps/user_ldap/lib/User/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ public function getAttributes($minimal = false) {
);
}

// remove possible empty attributes
$attributes = array_values(
array_filter($attributes, function ($attributeName) {
return !empty($attributeName);
})
);

return $attributes;
}

Expand Down
7 changes: 6 additions & 1 deletion apps/user_ldap/tests/User/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,17 @@ public function testGetAttributes($minimal) {
$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));
}
Expand Down