Ajout gestion authentification dans test LDAP
This commit is contained in:
parent
7bcd563c75
commit
75a82a31ce
@ -292,7 +292,7 @@ print '</div>';
|
||||
*/
|
||||
if (function_exists("ldap_connect"))
|
||||
{
|
||||
if ($conf->global->LDAP_SERVER_HOST && $conf->global->LDAP_ADMIN_DN && $conf->global->LDAP_ADMIN_PASS)
|
||||
if ($conf->global->LDAP_SERVER_HOST)
|
||||
{
|
||||
print '<a class="tabAction" href="'.$_SERVER["PHP_SELF"].'?action=test">'.$langs->trans("LDAPTestConnect").'</a><br><br>';
|
||||
}
|
||||
@ -301,8 +301,8 @@ if (function_exists("ldap_connect"))
|
||||
{
|
||||
$ldap = new AuthLdap(); // Les parametres sont passés et récupérés via $conf
|
||||
|
||||
$ds = $ldap->connect();
|
||||
if ($ds)
|
||||
$result = $ldap->connect(); // Avec OpenLDAP 2.x.x, $reslt sera toujours vrai car connection a lieu dans premeiere fonction ldap_*
|
||||
if ($result)
|
||||
{
|
||||
// Test ldap_bind
|
||||
$bind = $ldap->bind();
|
||||
@ -310,6 +310,28 @@ if (function_exists("ldap_connect"))
|
||||
{
|
||||
print img_picto('','info').' ';
|
||||
print '<font class="ok">'.$langs->trans("LDAPTCPConnectOK",$conf->global->LDAP_SERVER_HOST,$conf->global->LDAP_SERVER_PORT).'</font><br>';
|
||||
|
||||
if ($conf->global->LDAP_ADMIN_DN && $conf->global->LDAP_ADMIN_PASS)
|
||||
{
|
||||
$authbind = $ldap->authBind($conf->global->LDAP_ADMIN_DN,$conf->global->LDAP_ADMIN_PASS);
|
||||
if ($authbind)
|
||||
{
|
||||
print img_picto('','info').' ';
|
||||
print '<font class="ok">'.$langs->trans("LDAPBindOK",$conf->global->LDAP_SERVER_HOST,$conf->global->LDAP_SERVER_PORT,$conf->global->LDAP_ADMIN_DN,$conf->global->LDAP_ADMIN_PASS).'</font><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto('','error').' ';
|
||||
print '<font class="error">'.$langs->trans("LDAPBindKO",$conf->global->LDAP_SERVER_HOST,$conf->global->LDAP_SERVER_PORT,$conf->global->LDAP_ADMIN_DN,$conf->global->LDAP_ADMIN_PASS).' : ';
|
||||
print $ldap->ldapErrorCode." - ".$ldap->ldapErrorText;
|
||||
print "</font><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto('','warning').' ';
|
||||
print '<font class="warning">'.$langs->trans("LDAPNoUserOrPasswordProvidedAccessIsReadOnly").'</font><br>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -319,6 +341,7 @@ if (function_exists("ldap_connect"))
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
|
||||
// Test ldap_getversion
|
||||
if (($ldap->getVersion() == 3))
|
||||
{
|
||||
|
||||
@ -54,7 +54,10 @@ if (!$user->admin)
|
||||
|
||||
if ($_GET["action"] == 'setvalue' && $user->admin)
|
||||
{
|
||||
|
||||
if (! dolibarr_set_const($db, 'LDAP_CONTACT_DN',$_POST["contactdn"]))
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -121,8 +124,11 @@ $var=true;
|
||||
$html=new Form($db);
|
||||
|
||||
|
||||
// Not available
|
||||
print '<tr '.$bc[!$var].'><td colspan="3">'.$langs->trans("LDAPParametersAreStillHardCoded").'</td></tr>';
|
||||
// DN Pour les contacts
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPContactDn").'</td><td>';
|
||||
print '<input size="38" type="text" name="contactdn" value="'.$conf->global->LDAP_CONTACT_DN.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPContactDnExample").'</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
|
||||
|
||||
@ -529,6 +529,8 @@ LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=society,dc=com)
|
||||
LDAPTestConnect=Test LDAP connection
|
||||
LDAPTCPConnectOK=TCP connect to LDAP server successful (Server=%s, Port=%s)
|
||||
LDAPTCPConnectKO=TCP connect to LDAP server failed (Server=%s, Port=%s)
|
||||
LDAPBindOK=Connect/Authentificate to LDAP server sucessfull (Server=%s, Port=%s, Admin=%s)
|
||||
LDAPBindKO=Connect/Authentificate to LDAP server failed (Server=%s, Port=%s, Admin=%s)
|
||||
LDAPUnbindSuccessfull=Disconnect successfull
|
||||
LDAPUnbindFailed=Disconnect failed
|
||||
LDAPConnectToDNSuccessfull=Connection au DN (%s) réussie
|
||||
@ -556,6 +558,7 @@ LDAPFieldMobile=Cellular phone
|
||||
LDAPFieldMobileExample=Default attribute : mobile
|
||||
LDAPParametersAreStillHardCoded=LDAP parametres are still hardcoded (in contact class)
|
||||
LDAPSetupNotComplete=LDAP setup not complete (go on others tabs)
|
||||
LDAPNoUserOrPasswordProvidedAccessIsReadOnly=No administrator or password provided. LDAP access will be anonymous and in read only mode.
|
||||
##### Products #####
|
||||
ProductSetup=Products module setup
|
||||
NumberOfProductShowInSelect=Max number of products in combos select lists (0=no limit)
|
||||
|
||||
@ -527,8 +527,10 @@ LDAPDnContactActiveExample=Synchronisation activ
|
||||
LDAPContactDn=DN des contacts Dolibarr
|
||||
LDAPContactDnExample=DN complet (ex: ou=contacts,dc=societe,dc=com)
|
||||
LDAPTestConnect=Tester la connexion LDAP
|
||||
LDAPTCPConnectOK=Connexion TCP au serveur LDAP réussie (Server=%s, Port=%s)
|
||||
LDAPTCPConnectKO=Connexion TCP au serveur LDAP échouée (Server=%s, Port=%s)
|
||||
LDAPTCPConnectOK=Connexion TCP au serveur LDAP réussie (Serveur=%s, Port=%s)
|
||||
LDAPTCPConnectKO=Connexion TCP au serveur LDAP échouée (Serveur=%s, Port=%s)
|
||||
LDAPBindOK=Connection/Authentification au serveur LDAP réussie (Serveur=%s, Port=%s, Admin=%s)
|
||||
LDAPBindKO=Connection/Authentification au serveur LDAP échouée (Serveur=%s, Port=%s, Admin=%s)
|
||||
LDAPUnbindSuccessfull=Déconnection réussie
|
||||
LDAPUnbindFailed=Déconnection échouée
|
||||
LDAPConnectToDNSuccessfull=Connection au DN (%s) réussie
|
||||
@ -556,6 +558,7 @@ LDAPFieldMobile=T
|
||||
LDAPFieldMobileExample=Attribut par défaut : mobile
|
||||
LDAPParametersAreStillHardCoded=Les parametres LDAP sont codés en dur (dans classe contact)
|
||||
LDAPSetupNotComplete=Configuration LDAP incomplète (à compléter sur les autres onglets)
|
||||
LDAPNoUserOrPasswordProvidedAccessIsReadOnly=Administrateur ou mot de passe non renseigné. Les accès LDAP seront donc anonymes et en lecture seule.
|
||||
##### Products #####
|
||||
ProductSetup=Configuration du module Produits
|
||||
NumberOfProductShowInSelect=Nombre de produits max dans les listes déroulantes (0=aucune limite)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user