mirror of
https://github.com/filegator/filegator.git
synced 2025-08-12 17:24:14 +02:00
Adds an attributes parameter to the ldap adapter (#184)
* Adds an attribute parameter to the ldap adapter Using this parameter is much more efficient than the default action (which is to return all attributes and their associated values). The use of this parameter should therefore be considered good practice. (from https://www.php.net/manual/en/function.ldap-search.php) * Updates the docs about ldap_attributes parameter * Enhances portuguese translation * Update backend/Services/Auth/Adapters/LDAP.php Commit suggestion
This commit is contained in:
@@ -30,6 +30,7 @@ class LDAP implements Service, AuthInterface
|
||||
protected $ldap_bindPass;
|
||||
protected $ldap_baseDN;
|
||||
protected $ldap_filter;
|
||||
protected $ldap_attributes;
|
||||
protected $ldap_userFieldMapping;
|
||||
|
||||
public function __construct(Session $session)
|
||||
@@ -52,6 +53,7 @@ class LDAP implements Service, AuthInterface
|
||||
$this->ldap_bindPass = $config['ldap_bindPass'];
|
||||
$this->ldap_baseDN = $config['ldap_baseDN'];
|
||||
$this->ldap_filter = $config['ldap_filter'];
|
||||
$this->ldap_attributes = isset($config['ldap_attributes']) ? $config['ldap_attributes'] : ['*'];
|
||||
$this->ldap_userFieldMapping = $config['ldap_userFieldMapping'];
|
||||
}else {
|
||||
@ldap_close($connect);
|
||||
@@ -166,7 +168,7 @@ class LDAP implements Service, AuthInterface
|
||||
if (!$ldapBind) throw new \Exception('Cannot Bind to LDAP server: Wrong credentials?');
|
||||
|
||||
// search the LDAP server for users
|
||||
$ldapSearch = @ldap_search($ldapConn, $this->ldap_baseDN, $this->ldap_filter, ['*']);
|
||||
$ldapSearch = @ldap_search($ldapConn, $this->ldap_baseDN, $this->ldap_filter, $this->ldap_attributes);
|
||||
$ldapResults = @ldap_get_entries($ldapConn, $ldapSearch);
|
||||
@ldap_close($ldapConn);
|
||||
|
||||
|
Reference in New Issue
Block a user