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