bug: Improve LDAP filter in the getUserlist() function (#8253)

Improve LDAP filtering to improve the speed of some pages (Dashboard and
Edit User mainly). If we don't apply this filter all the users are getted
from LDAP and used in to the loop, with 2k users (for us) the page take
more than 15 seconds to be loaded.

I have check than people still have differante access with this fix.
This commit is contained in:
pep-un 2018-03-09 17:58:28 +01:00 committed by Neil Lathwood
parent 72dffd8d95
commit 0e09e09f04
1 changed files with 1 additions and 1 deletions

View File

@ -136,7 +136,7 @@ class LdapAuthorizer extends AuthorizerBase
try {
$connection = $this->getLdapConnection();
$filter = '(' . Config::get('auth_ldap_prefix') . '*)';
$filter = '(&(' . Config::get('auth_ldap_prefix') . '*)(memberOf=' . trim(Config::get('auth_ldap_group'), ',') . '))';
$search = ldap_search($connection, trim(Config::get('auth_ldap_suffix'), ','), $filter);
$entries = ldap_get_entries($connection, $search);