diff options
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/js/wizard/wizard.js | 4 | ||||
-rw-r--r-- | apps/user_ldap/lib/User/Manager.php | 7 | ||||
-rw-r--r-- | apps/user_ldap/tests/User/ManagerTest.php | 7 |
3 files changed, 15 insertions, 3 deletions
diff --git a/apps/user_ldap/js/wizard/wizard.js b/apps/user_ldap/js/wizard/wizard.js index 62a3fccbdfb..9ac03e117cd 100644 --- a/apps/user_ldap/js/wizard/wizard.js +++ b/apps/user_ldap/js/wizard/wizard.js @@ -45,7 +45,7 @@ OCA = OCA || {}; // for example, BaseDN detector needs the port. The port is typically found // by the Port Detector. If BaseDN detector was run first, it will not have // all necessary information. Only after Port Detector was executed… - for (var i = 0; i <= detectors.length; i++) { + for (var i = 0; i < detectors.length; i++) { model.registerDetector(detectors[i]); } @@ -61,7 +61,7 @@ OCA = OCA || {}; var view = new OCA.LDAP.Wizard.WizardView(model); view.init(); view.setModel(model); - for (var j = 0; j <= tabs.length; j++) { + for (var j = 0; j < tabs.length; j++) { view.registerTab(tabs[j], '#ldapWizard' + (j + 2)); } 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)); } |