diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-10-29 17:00:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-29 17:00:14 +0100 |
commit | 76c31857cbabd51507acac5c23e3cebfb955c961 (patch) | |
tree | 9135ee69ffcb2ebeb8f719866852c47cb527d305 /apps | |
parent | 3aae3c82a4cf9d31814fe5cfb3018dd3184072b7 (diff) | |
parent | d47e1513bcdba9f8e4ea96e10098e71d35b649a5 (diff) | |
download | nextcloud-server-76c31857cbabd51507acac5c23e3cebfb955c961.tar.gz nextcloud-server-76c31857cbabd51507acac5c23e3cebfb955c961.zip |
Merge pull request #12107 from nextcloud/fix/12086/no-unintentional-empty-attributes
remove unneeded empty LDAP search attribute values
Diffstat (limited to 'apps')
-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)); } |