Début ajout synchro ldap2dolibarr à la connexion

This commit is contained in:
Regis Houssin 2007-05-30 18:06:00 +00:00
parent 223d463cdd
commit adb3461bc6
2 changed files with 16 additions and 2 deletions

View File

@ -426,7 +426,7 @@ class Auth_Container_LDAP extends Auth_Container
$attributes['count'] > 0) $attributes['count'] > 0)
{ {
$this->_debug('Saving attributes to Auth data', __LINE__); $this->_debug('Saving attributes to Auth data', __LINE__);
DOLIAUTH::setAuthData('attributes', $attributes); DOLIAuth::setAuthData('attributes', $attributes);
} }
} }
@ldap_free_result($result_id); @ldap_free_result($result_id);

View File

@ -303,6 +303,17 @@ if (! session_id() || ! isset($_SESSION["dol_login"]))
if (! $ldapadminpass) $ldapadminpass=$conf->global->LDAP_ADMIN_PASS; if (! $ldapadminpass) $ldapadminpass=$conf->global->LDAP_ADMIN_PASS;
// Fin code pour compatiblité // Fin code pour compatiblité
// Si synchro ldap2dolibarr on récupère les attributs de l'utilisateur
// afin de les synchroniser à sa connexion
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')
{
$attrArray = array(); // récupération de tous les attributs de l'utilisateur
}
else
{
$attrArray = array(''); // aucun attribut récupéré
}
$params = array( $params = array(
'userattr' => $ldapuserattr, 'userattr' => $ldapuserattr,
'host' => $ldaphost, 'host' => $ldaphost,
@ -312,7 +323,7 @@ if (! session_id() || ! isset($_SESSION["dol_login"]))
'binddn' => $ldapadminlogin, 'binddn' => $ldapadminlogin,
'bindpw' => $ldapadminpass, 'bindpw' => $ldapadminpass,
'debug' => $ldapdebug, 'debug' => $ldapdebug,
//'attributes' => array('pwdlastset'), 'attributes' => $attrArray,
'userfilter' => '' 'userfilter' => ''
); );
if ($ldapdebug) print "DEBUG: params=".join(',',$params)."<br>\n"; if ($ldapdebug) print "DEBUG: params=".join(',',$params)."<br>\n";
@ -326,6 +337,9 @@ if (! session_id() || ! isset($_SESSION["dol_login"]))
// Authentification Auth OK, on va chercher le login // Authentification Auth OK, on va chercher le login
$login=$aDol->getUsername(); $login=$aDol->getUsername();
dolibarr_syslog ("Authentification ok (en mode Pear Base LDAP)"); dolibarr_syslog ("Authentification ok (en mode Pear Base LDAP)");
// Récupération des attributs de l'utilisateur
$attributs = $aDol->getAuthData("attributes");
} }
else else
{ {