diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-10-29 20:06:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-29 20:06:28 +0100 |
commit | 8a452dc8d0238633eb5d4d4d4762499c739217ff (patch) | |
tree | d2006422b1cb5126cd46b23f86fa383dc955b463 | |
parent | 074672f8f26e2f1e1b41758e1b63279b6d6c1381 (diff) | |
parent | 36b21e5e4e6ef27adfefcbb2cfdcd4d8d232e287 (diff) | |
download | nextcloud-server-8a452dc8d0238633eb5d4d4d4762499c739217ff.tar.gz nextcloud-server-8a452dc8d0238633eb5d4d4d4762499c739217ff.zip |
Merge pull request #12122 from nextcloud/backport/12107/stable14
[stable14] remove unneeded empty search attribute values, fixes #12086
-rw-r--r-- | apps/user_ldap/lib/User/Manager.php | 7 | ||||
-rw-r--r-- | apps/user_ldap/tests/User/ManagerTest.php | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php index c48193c7ad9..9f2f3649777 100644 --- a/apps/user_ldap/lib/User/Manager.php +++ b/apps/user_ldap/lib/User/Manager.php @@ -197,6 +197,13 @@ class Manager { ); } + // remove possible empty attributes + $attributes = array_values( + array_filter($attributes, function ($attributeName) { + return !empty($attributeName); + }) + ); + return $attributes; } diff --git a/apps/user_ldap/tests/User/ManagerTest.php b/apps/user_ldap/tests/User/ManagerTest.php index 5399aa95a6a..104a70ff700 100644 --- a/apps/user_ldap/tests/User/ManagerTest.php +++ b/apps/user_ldap/tests/User/ManagerTest.php @@ -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)); } |