Merge pull request #12123 from nextcloud/backport/12107/stable13
[stable13] remove unneeded empty search attribute values, fixes #12086
This commit is contained in:
commit
661062271f
|
@ -197,6 +197,13 @@ class Manager {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove possible empty attributes
|
||||||
|
$attributes = array_values(
|
||||||
|
array_filter($attributes, function ($attributeName) {
|
||||||
|
return !empty($attributeName);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
return $attributes;
|
return $attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,12 +256,17 @@ class ManagerTest extends \Test\TestCase {
|
||||||
$manager->setLdapAccess($access);
|
$manager->setLdapAccess($access);
|
||||||
|
|
||||||
$connection = $access->getConnection();
|
$connection = $access->getConnection();
|
||||||
$connection->setConfiguration(['ldapEmailAttribute' => 'mail', 'ldapUserAvatarRule' => 'default']);
|
$connection->setConfiguration([
|
||||||
|
'ldapEmailAttribute' => 'mail',
|
||||||
|
'ldapUserAvatarRule' => 'default',
|
||||||
|
'ldapQuotaAttribute' => '',
|
||||||
|
]);
|
||||||
|
|
||||||
$attributes = $manager->getAttributes($minimal);
|
$attributes = $manager->getAttributes($minimal);
|
||||||
|
|
||||||
$this->assertTrue(in_array('dn', $attributes));
|
$this->assertTrue(in_array('dn', $attributes));
|
||||||
$this->assertTrue(in_array($access->getConnection()->ldapEmailAttribute, $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('jpegphoto', $attributes));
|
||||||
$this->assertSame(!$minimal, in_array('thumbnailphoto', $attributes));
|
$this->assertSame(!$minimal, in_array('thumbnailphoto', $attributes));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue