]> source.dussan.org Git - nextcloud-server.git/commitdiff
remove unneeded empty search attribute values, fixes #12086 12122/head
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Mon, 29 Oct 2018 12:21:02 +0000 (13:21 +0100)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Mon, 29 Oct 2018 16:26:44 +0000 (17:26 +0100)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
apps/user_ldap/lib/User/Manager.php
apps/user_ldap/tests/User/ManagerTest.php

index c48193c7ad94f663ebd4caa18a65f8a151c98be3..9f2f3649777dc4ce96807a2f82c002120d70e8b8 100644 (file)
@@ -197,6 +197,13 @@ class Manager {
                        );
                }
 
+               // remove possible empty attributes
+               $attributes = array_values(
+                       array_filter($attributes, function ($attributeName) {
+                               return !empty($attributeName);
+                       })
+               );
+
                return $attributes;
        }
 
index 5399aa95a6a04969d42f808b502796c1013d6809..104a70ff70024ce462cfffd992bde65d5bdb8303 100644 (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));
        }