mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-20 00:58:48 +02:00
Beta version of the LDAP authentication module: added parameters %2$s (first name), %3$s (first name) and %4$s (email) as possible placeholders into the LDAP query.
SVN:trunk[633]
This commit is contained in:
@@ -89,7 +89,26 @@ class UserLDAP extends User
|
||||
$sLDAPUserQuery = MetaModel::GetModuleSetting('authent-ldap', 'user_query', '');
|
||||
$sBaseDN = MetaModel::GetModuleSetting('authent-ldap', 'base_dn', '');
|
||||
|
||||
$sQuery = sprintf($sLDAPUserQuery, $this->Get('login'));
|
||||
$sLogin = $this->Get('login');
|
||||
$iContactId = $this->Get('contactid');
|
||||
$sFirstName = '';
|
||||
$sLastName = '';
|
||||
$sEMail = '';
|
||||
if ($iContactId > 0)
|
||||
{
|
||||
$oPerson = MetaModel::GetObject('Person', $iContactId);
|
||||
if (is_object($oPerson))
|
||||
{
|
||||
$sFirstName = $oPerson->Get('first_name');
|
||||
$sLastName = $oPerson->Get('name');
|
||||
$sEMail = $oPerson->Get('email');
|
||||
}
|
||||
}
|
||||
// %1$s => login
|
||||
// %2$s => first name
|
||||
// %3$s => last name
|
||||
// %4$s => email
|
||||
$sQuery = sprintf($sLDAPUserQuery, $sLogin, $sFirstName, $sLastName, $sEMail);
|
||||
$hSearchResult = @ldap_search($hDS, $sBaseDN, $sQuery);
|
||||
|
||||
$iCountEntries = ($hSearchResult !== false) ? @ldap_count_entries($hDS, $hSearchResult) : 0;
|
||||
|
||||
Reference in New Issue
Block a user