Modif: les DN ldap doivent dsormait tre mis en entier
This commit is contained in:
parent
9627a152f7
commit
6cef0f699b
@ -28,15 +28,14 @@
|
||||
\brief Page d'administration/configuration du module Ldap
|
||||
\version $Revision$
|
||||
\remarks Exemple configuration :
|
||||
LDAP_SERVER_HOST Serveur LDAP 192.168.1.50
|
||||
LDAP_SERVER_PORT Port LDAP 123
|
||||
LDAP_SUFFIX_DN Suffix LDAP dc=societe,dc=com
|
||||
LDAP_ADMIN_DN Administrateur LDAP cn=adminldap
|
||||
LDAP_ADMIN_PASS Mot de passe xxxxxxxx
|
||||
LDAP_USER_DN DN des utilisateurs ou=users
|
||||
LDAP_GROUP_DN DN des groupes ou=groups
|
||||
LDAP_CONTACT_DN DN des contacts ou=contacts
|
||||
LDAP_SERVER_TYPE Type Openldap
|
||||
LDAP_SERVER_HOST Serveur LDAP 192.168.1.50
|
||||
LDAP_SERVER_PORT Port LDAP 389
|
||||
LDAP_ADMIN_DN Administrateur LDAP cn=adminldap,dc=societe,dc=com
|
||||
LDAP_ADMIN_PASS Mot de passe xxxxxxxx
|
||||
LDAP_USER_DN DN des utilisateurs ou=users,dc=societe,dc=com
|
||||
LDAP_GROUP_DN DN des groupes ou=groups,dc=societe,dc=com
|
||||
LDAP_CONTACT_DN DN des contacts ou=contacts,dc=societe,dc=com
|
||||
LDAP_SERVER_TYPE Type Openldap
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -66,13 +65,15 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
||||
('LDAP_SERVER_PORT','".$_POST["port"]."',0);";
|
||||
$db->query($sql);
|
||||
|
||||
//suppression pour compatibilité divers config ldap
|
||||
//
|
||||
//$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SUFFIX_DN';";
|
||||
//$db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_SUFFIX_DN';";
|
||||
$db->query($sql);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
||||
('LDAP_SUFFIX_DN','".$_POST["suffix"]."',0);";
|
||||
$db->query($sql);
|
||||
//$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible) VALUES
|
||||
//('LDAP_SUFFIX_DN','".$_POST["suffix"]."',0);";
|
||||
//$db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'LDAP_ADMIN_DN';";
|
||||
$db->query($sql);
|
||||
@ -163,14 +164,18 @@ print "</tr>\n";
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LDAPServerPort").'</td><td>'.$langs->trans("LDAPServerPortExample").'</td></tr>';
|
||||
}
|
||||
if (defined("LDAP_SUFFIX_DN") && LDAP_SUFFIX_DN)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LDAPSuffix").'</td><td>'.LDAP_SUFFIX_DN.'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LDAPSuffix").'</td><td>'.$langs->trans("LDAPSuffixExample").'</td></tr>';
|
||||
}
|
||||
|
||||
//suppression pour compatibilité divers config ldap
|
||||
//
|
||||
//if (defined("LDAP_SUFFIX_DN") && LDAP_SUFFIX_DN)
|
||||
//{
|
||||
// print '<tr><td>'.$langs->trans("LDAPSuffix").'</td><td>'.LDAP_SUFFIX_DN.'</td></tr>';
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// print '<tr><td>'.$langs->trans("LDAPSuffix").'</td><td>'.$langs->trans("LDAPSuffixExample").'</td></tr>';
|
||||
//}
|
||||
|
||||
if (defined("LDAP_ADMIN_DN") && LDAP_ADMIN_DN)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DNAdmin").'</td><td>'.LDAP_ADMIN_DN.'</td></tr>';
|
||||
@ -257,9 +262,13 @@ else
|
||||
print '<input size="25" type="text" name="port" value="389">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("LDAPSuffix").'</td><td>';
|
||||
print '<input size="25" type="text" name="suffix" value="'.LDAP_SUFFIX_DN.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
//suppression pour compatibilité divers config ldap
|
||||
//
|
||||
//print '<tr><td>'.$langs->trans("LDAPSuffix").'</td><td>';
|
||||
//print '<input size="25" type="text" name="suffix" value="'.LDAP_SUFFIX_DN.'">';
|
||||
//print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("DNAdmin").'</td><td>';
|
||||
print '<input size="25" type="text" name="admin" value="'.LDAP_ADMIN_DN.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -232,7 +232,7 @@ class Contact
|
||||
if ($this->email)
|
||||
$info["mail"] = $this->email;
|
||||
|
||||
$dn = "cn=".$info["cn"].",".LDAP_CONTACT_DN.",".LDAP_SUFFIX_DN;
|
||||
$dn = "cn=".$info["cn"].",".LDAP_CONTACT_DN;
|
||||
|
||||
$r = @ldap_delete($ds, $dn);
|
||||
|
||||
@ -330,7 +330,7 @@ class Contact
|
||||
$info["mail"] = $this->email;
|
||||
}
|
||||
|
||||
$dn = "cn=".$info["cn"].",".LDAP_CONTACT_DN.",".LDAP_SUFFIX_DN;
|
||||
$dn = "cn=".$info["cn"].",".LDAP_CONTACT_DN;
|
||||
|
||||
$r = @ldap_delete($ds, $dn);
|
||||
|
||||
@ -601,7 +601,7 @@ class Contact
|
||||
{
|
||||
$userdn = utf8_encode($this->old_firstname." ".$this->old_name);
|
||||
}
|
||||
$dn = "cn=".$userdn.",".LDAP_CONTACT_DN.",".LDAP_SUFFIX_DN;
|
||||
$dn = "cn=".$userdn.",".LDAP_CONTACT_DN;
|
||||
|
||||
$r = @ldap_delete($ds, $dn);
|
||||
|
||||
|
||||
@ -268,22 +268,22 @@ LDAPServer=LDAP Server
|
||||
LDAPServerPort=LDAP server port
|
||||
LDAPServerPortExample=Default port : 389
|
||||
TestConnectLdap=Test connection
|
||||
LDAPSuffix=LDAP suffix
|
||||
DNAdmin=LDAP Administrator
|
||||
#LDAPSuffix=LDAP suffix
|
||||
DNAdmin=Administrator' DN
|
||||
LDAPPassword=Password
|
||||
DNUser=Users' DN
|
||||
DNGroup=Groups' DN
|
||||
LDAPServerExample=Server adress
|
||||
LDAPSuffixExample=ex: dc=company,dc=com
|
||||
DNAdminExample=ex: cn=adminldap
|
||||
#LDAPSuffixExample=ex: dc=company,dc=com
|
||||
DNAdminExample=Complete DN (ex: cn=adminldap,dc=society,dc=com)
|
||||
LDAPPasswordExample=Admin password
|
||||
DNUserExample=ex: ou=users
|
||||
DNGroupExample=ex: ou=groups
|
||||
DNUserExample=Complete DN (ex: ou=users,dc=society,dc=com)
|
||||
DNGroupExample=Complete DN (ex: ou=groups,dc=society,dc=com)
|
||||
DNContactActive=Contacts' synchronization?
|
||||
DNContactActiveYes=Activated synchronization
|
||||
DNContactActiveExample=Desactivated synchronization
|
||||
DNContact=Contacts' DN
|
||||
DNContactExample=ex: ou=contacts
|
||||
DNContactExample=Complete DN (ex: ou=contacts,dc=society,dc=com)
|
||||
TypeExample=OpenLdap, Egroupware or Active Directory
|
||||
##### Propal #####
|
||||
PropalSetup=Commercial proposals module setup
|
||||
@ -299,4 +299,8 @@ SyslogSimpleFile=File
|
||||
SyslogFilename=File name and path
|
||||
ErrorUnknownSyslogConstant=Constant %s is not a known syslog constant
|
||||
##### Donations #####
|
||||
DonationsSetup=Donation module setup
|
||||
DonationsSetup=Donation module setup
|
||||
##### Barcode #####
|
||||
BarcodeSetup=Barcode setup
|
||||
PaperFormatModule=Print' format module
|
||||
BarcodeEncodeModule=Barcode' encodage module
|
||||
@ -268,22 +268,22 @@ LDAPServer=Serveur LDAP
|
||||
LDAPServerPort=Port du serveur LDAP
|
||||
LDAPServerPortExample=Port par défaut : 389
|
||||
TestConnectLdap=Tester la connexion
|
||||
LDAPSuffix=Suffix LDAP
|
||||
DNAdmin=Administrateur LDAP
|
||||
#LDAPSuffix=Suffix LDAP
|
||||
DNAdmin=DN de l'administrateur
|
||||
LDAPPassword=Mot de passe
|
||||
DNUser=DN des utilisateurs
|
||||
DNGroup=DN des groupes
|
||||
LDAPServerExample=Adresse du serveur
|
||||
LDAPSuffixExample=ex: dc=societe,dc=com
|
||||
DNAdminExample=ex: cn=adminldap
|
||||
#LDAPSuffixExample=DN complet (ex: dc=societe,dc=com)
|
||||
DNAdminExample=DN complet (ex: cn=adminldap,dc=societe,dc=com)
|
||||
LDAPPasswordExample=Mot de passe de l'administrateur
|
||||
DNUserExample=ex: ou=users
|
||||
DNGroupExample=ex: ou=groups
|
||||
DNUserExample=DN complet (ex: ou=users,dc=societe,dc=com)
|
||||
DNGroupExample=DN complet (ex: ou=groups,dc=societe,dc=com)
|
||||
DNContactActive=Synchronisation des contacts ?
|
||||
DNContactActiveYes=Synchronisation activée
|
||||
DNContact=DN des contacts
|
||||
DNContactActiveExample=Synchronisation désactivée
|
||||
DNContactExample=ex: ou=contacts
|
||||
DNContactExample=DN complet (ex: ou=contacts,dc=societe,dc=com)
|
||||
TypeExample=OpenLdap, Egroupware ou Active Directory
|
||||
##### Propal #####
|
||||
PropalSetup=Configuration du module Propositions Commerciales
|
||||
@ -299,4 +299,8 @@ SyslogSimpleFile=Fichier
|
||||
SyslogFilename=Nom et chemin du fichier
|
||||
ErrorUnknownSyslogConstant=La constante %s n'est pas une constante syslog connue
|
||||
##### Donations #####
|
||||
DonationsSetup=Configuration du module Dons
|
||||
DonationsSetup=Configuration du module Dons
|
||||
##### Barcode #####
|
||||
BarcodeSetup=Configuration des codes barres
|
||||
PaperFormatModule=Modules de format d'impression
|
||||
BarcodeEncodeModule=Modules d'encodage des codes barres
|
||||
@ -54,19 +54,12 @@ function dolibarr_ldap_connect()
|
||||
|
||||
function dolibarr_ldap_bind($ds)
|
||||
{
|
||||
if (defined("LDAP_ADMIN_PASS") && LDAP_SUFFIX_DN && LDAP_ADMIN_DN && LDAP_ADMIN_PASS)
|
||||
if (defined("LDAP_ADMIN_PASS") && LDAP_ADMIN_DN && LDAP_ADMIN_PASS)
|
||||
{
|
||||
if (defined("LDAP_SERVER_TYPE") && LDAP_USER_DN && LDAP_SERVER_TYPE == activedirectory)
|
||||
{
|
||||
$ldapbind = ldap_bind($ds, LDAP_ADMIN_DN.",".LDAP_USER_DN.",".LDAP_SUFFIX_DN, LDAP_ADMIN_PASS);
|
||||
}
|
||||
else
|
||||
{
|
||||
$ldapbind = ldap_bind($ds, LDAP_ADMIN_DN.",".LDAP_SUFFIX_DN, LDAP_ADMIN_PASS);
|
||||
}
|
||||
$ldapbind = ldap_bind($ds, LDAP_ADMIN_DN, LDAP_ADMIN_PASS);
|
||||
}
|
||||
|
||||
return $ldapbind;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Loading…
Reference in New Issue
Block a user