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:
Denis Flaven
2010-07-27 16:39:38 +00:00
parent 1045d8891b
commit 86f953383e

View File

@@ -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;