Ajout gestion de la gestion du protocole

This commit is contained in:
Rodolphe Quiedeville 2005-08-08 12:13:41 +00:00
parent b822ab599c
commit 7b34878ed2

View File

@ -117,6 +117,14 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
('LDAP_CONTACT_DN','".$_POST["contact"]."',0);"; ('LDAP_CONTACT_DN','".$_POST["contact"]."',0);";
$db->query($sql); $db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_PROTOCOLVERSION';";
$db->query($sql);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
('LDAP_SERVER_PROTOCOLVERSION','".$_POST["version"]."',0);";
$db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_TYPE';"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SERVER_TYPE';";
$db->query($sql); $db->query($sql);
@ -233,6 +241,8 @@ print "</tr>\n";
print '<tr><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("TypeExample").'</td></tr>'; print '<tr><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("TypeExample").'</td></tr>';
} }
print '<tr><td>'.$langs->trans("Version").'</td><td>'.LDAP_SERVER_PROTOCOLVERSION.'</td></tr>';
print '</table>'; print '</table>';
print '</td><td width="50%">'; print '</td><td width="50%">';
@ -329,6 +339,22 @@ print '<option value="activedirectory">Active Directory';
print '</select>'; print '</select>';
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Version").'</td><td><select name="version">';
if (defined("LDAP_SERVER_PROTOCOLVERSION") && LDAP_SERVER_PROTOCOLVERSION == 3)
{
print '<option value="3" selected>Version 3';
}
else
{
print '<option value="2" selected>Version 2';
}
print '<option value="LDAP_SERVER_PROTOCOLVERSION">------------------------';
print '<option value="3">Version 3';
print '<option value="2">Version 2';
print '</select>';
print '</td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Modify").'"></td></tr>'; print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Modify").'"></td></tr>';
print '</table></form>'; print '</table></form>';
@ -347,36 +373,45 @@ if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST) {
if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST && LDAP_ADMIN_DN && LDAP_ADMIN_PASS && $_GET["action"] == 'test') if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST && LDAP_ADMIN_DN && LDAP_ADMIN_PASS && $_GET["action"] == 'test')
{ {
$ds = dolibarr_ldap_connect(); $ds = dolibarr_ldap_connect();
/*
if ($ds) if ($ds)
{ {
print img_picto('','info');
print "connexion au serveur ldap réussie<br>"; print "connexion au serveur ldap réussie<br>";
} }
else else
{ {
print "connexion au serveur ldap échouée";
print img_picto('','alerte'); print img_picto('','alerte');
print "connexion au serveur ldap échouée";
print "<br>";
print ldap_error($ds);
print "<br>"; print "<br>";
} }
if ((dolibarr_ldap_getversion($ds) == 3)) if ((dolibarr_ldap_getversion($ds) == 3))
{ {
print img_picto('','info');
print "Serveur ldap configuré en version 3<br>"; print "Serveur ldap configuré en version 3<br>";
} }
else else
{ {
print img_picto('','info');
print "Serveur ldap configuré en version 2<br>"; print "Serveur ldap configuré en version 2<br>";
} }
*/
$bind = @dolibarr_ldap_bind($ds); $bind = @dolibarr_ldap_bind($ds);
if ($bind) if ($bind)
{ {
print img_picto('','info');
print "connexion au dn $dn réussi<br>"; print "connexion au dn $dn réussi<br>";
} }
else else
{ {
print "connexion au dn $dn raté";
print img_picto('','alerte'); print img_picto('','alerte');
print "connexion au dn $dn raté : ";
print ldap_error($ds);
print "<br>"; print "<br>";
} }
@ -384,12 +419,14 @@ if (defined("LDAP_SERVER_HOST") && LDAP_SERVER_HOST && LDAP_ADMIN_DN && LDAP_ADM
if ($bind) if ($bind)
{ {
print img_picto('','info');
print "déconnection du dn $dn réussi<br>"; print "déconnection du dn $dn réussi<br>";
} }
else else
{ {
print "déconnection du dn $dn raté";
print img_picto('','alerte'); print img_picto('','alerte');
print "déconnection du dn $dn raté";
print "<br>"; print "<br>";
} }
} }