Fix: A lot of fix on LDAP synchro.

This commit is contained in:
Laurent Destailleur 2009-08-12 12:12:15 +00:00
parent cecc4c0744
commit babdec527f
8 changed files with 39 additions and 82 deletions

View File

@ -18,16 +18,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/admin/ldap.php \file htdocs/admin/ldap.php
\ingroup ldap \ingroup ldap
\brief Page d'administration/configuration du module Ldap \brief Page d'administration/configuration du module Ldap
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");

View File

@ -106,7 +106,7 @@ print '<table class="noborder" width="100%">';
$var=true; $var=true;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("LDAPSynchronizeUsers").'</td>'; print '<td colspan="4">'.$langs->trans("LDAPSynchronizeContacts").'</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -98,7 +98,7 @@ print '<table class="noborder" width="100%">';
$var=true; $var=true;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("LDAPSynchronizeUsers").'</td>'; print '<td colspan="4">'.$langs->trans("LDAPSynchronizeGroups").'</td>';
print "</tr>\n"; print "</tr>\n";
// DN pour les groupes // DN pour les groupes

View File

@ -122,7 +122,7 @@ $var=true;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("LDAPSynchronizeUsers").'</td>'; print '<td colspan="4">'.$langs->trans("LDAPSynchronizeMembers").'</td>';
print "</tr>\n"; print "</tr>\n";
// DN Pour les adherents // DN Pour les adherents

View File

@ -770,7 +770,7 @@ class DolibarrModules
{ {
$row = $this->db->fetch_row($result); $row = $this->db->fetch_row($result);
if ($row[0] == 0) if ($row[0] == 0) // If not found
{ {
if (! $visible) $visible='0'; if (! $visible) $visible='0';
if (strlen($note)) if (strlen($note))
@ -814,6 +814,10 @@ class DolibarrModules
$err++; $err++;
} }
} }
else
{
dol_syslog("DolibarrModules::insert_const constant '".$name."' alreday exists");
}
} }
else else
{ {

View File

@ -19,23 +19,21 @@
*/ */
/** \defgroup ldap Module ldap /** \defgroup ldap Module ldap
\brief Module pour interfacer les contacts avec un annuaire Ldap \brief Module pour interfacer les contacts avec un annuaire Ldap
*/ */
/** /**
\file htdocs/includes/modules/modLdap.class.php * \file htdocs/includes/modules/modLdap.class.php
\ingroup ldap * \ingroup ldap
\brief Fichier de description et activation du module Ldap * \brief Fichier de description et activation du module Ldap
\version $Id$ * \version $Id$
*/ */
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php"); include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
/** \class modLdap /** \class modLdap
\brief Classe de description et activation du module Ldap * \brief Classe de description et activation du module Ldap
*/ */
class modLdap extends DolibarrModules class modLdap extends DolibarrModules
{ {
/** /**
@ -67,63 +65,21 @@ class modLdap extends DolibarrModules
$this->requiredby = array(); $this->requiredby = array();
// Constants // Constants
$this->const = array(); $this->const = array(
$r=0; 0=>array('LDAP_SERVER_TYPE','chaine','openldap','',0),
1=>array('LDAP_SERVER_PROTOCOLVERSION','chaine','3','',0),
$this->const[$r][0] = "LDAP_USER_DN"; 2=>array('LDAP_SERVER_HOST','chaine','localhost','',0),
$this->const[$r][1] = "chaine"; 3=>array('LDAP_USER_DN','chaine','ou=users,dc=my-domain,dc=com','',0),
$this->const[$r][2] = "ou=users,dc=my-domain,dc=com"; 4=>array('LDAP_GROUP_DN','chaine','ou=groups,dc=my-domain,dc=com','',0),
$r++; 5=>array('LDAP_FILTER_CONNECTION','chaine','&(objectClass=user)(objectCategory=person)','',0),
6=>array('LDAP_FIELD_LOGIN','chaine','uid','',0),
$this->const[$r][0] = "LDAP_GROUP_DN"; 7=>array('LDAP_FIELD_NAME','chaine','sn','',0),
$this->const[$r][1] = "chaine"; 8=>array('LDAP_FIELD_FIRSTNAME','chaine','givenname','',0),
$this->const[$r][2] = "ou=groups,dc=my-domain,dc=com"; 9=>array('LDAP_FIELD_MAIL','chaine','mail','',0),
$r++; 10=>array('LDAP_FIELD_PHONE','chaine','telephonenumber','',0),
11=>array('LDAP_FIELD_FAX','chaine','facsimiletelephonenumber','',0),
$this->const[$r][0] = "LDAP_FILTER_CONNECTION"; 12=>array('LDAP_FIELD_MOBILE','chaine','mobile','',0),
$this->const[$r][1] = "chaine"; );
$this->const[$r][2] = "&(objectClass=user)(objectCategory=person)";
$r++;
$this->const[$r][0] = "LDAP_FIELD_LOGIN";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "uid";
$r++;
$this->const[$r][0] = "LDAP_FIELD_LOGIN_SAMBA";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "samaccountname";
$r++;
$this->const[$r][0] = "LDAP_FIELD_NAME";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "sn";
$r++;
$this->const[$r][0] = "LDAP_FIELD_FIRSTNAME";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "givenname";
$r++;
$this->const[$r][0] = "LDAP_FIELD_MAIL";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "mail";
$r++;
$this->const[$r][0] = "LDAP_FIELD_PHONE";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "telephonenumber";
$r++;
$this->const[$r][0] = "LDAP_FIELD_FAX";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "facsimiletelephonenumber";
$r++;
$this->const[$r][0] = "LDAP_FIELD_MOBILE";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "mobile";
$r++;
// Boites // Boites
$this->boxes = array(); $this->boxes = array();

View File

@ -810,10 +810,10 @@ LDAPFunctionsNotAvailableOnPHP=LDAP functions are not available on your PHP
LDAPToDolibarr=LDAP -> Dolibarr LDAPToDolibarr=LDAP -> Dolibarr
DolibarrToLDAP=Dolibarr -> LDAP DolibarrToLDAP=Dolibarr -> LDAP
LDAPNamingAttribute=Key in LDAP LDAPNamingAttribute=Key in LDAP
LDAPSynchronizeUsers=Synchronize Dolibarr users with LDAP LDAPSynchronizeUsers=Organization of users in LDAP
LDAPSynchronizeGroups=Synchronize Dolibarr groups with LDAP LDAPSynchronizeGroups=Organization of groups in LDAP
LDAPSynchronizeContacts=Synchronize Dolibarr contacts with LDAP LDAPSynchronizeContacts=Organization of contacts in LDAP
LDAPSynchronizeMembers=Synchronize members of Dolibarr foundation module with LDAP LDAPSynchronizeMembers=Organization of foundation's members in LDAP
LDAPTypeExample=OpenLdap, Egroupware or Active Directory LDAPTypeExample=OpenLdap, Egroupware or Active Directory
LDAPPrimaryServer=Primary server LDAPPrimaryServer=Primary server
LDAPSecondaryServer=Secondary server LDAPSecondaryServer=Secondary server

View File

@ -810,10 +810,10 @@ LDAPFunctionsNotAvailableOnPHP = Les fonctions LDAP ne sont pas disponibles sur
LDAPToDolibarr = LDAP -> Dolibarr LDAPToDolibarr = LDAP -> Dolibarr
DolibarrToLDAP = Dolibarr -> LDAP DolibarrToLDAP = Dolibarr -> LDAP
LDAPNamingAttribute = Clé dans LDAP LDAPNamingAttribute = Clé dans LDAP
LDAPSynchronizeUsers = Synchronisation des utilisateurs Dolibarr avec LDAP LDAPSynchronizeUsers = Organisation des objets utilisateurs dans le LDAP
LDAPSynchronizeGroups = Synchronisation des groupes utilisateurs Dolibarr avec LDAP LDAPSynchronizeGroups = Organisation des objets groupes dans le LDAP
LDAPSynchronizeContacts = Synchronisation des contacts Dolibarr avec LDAP LDAPSynchronizeContacts = Organisation des objets contacts dans le LDAP
LDAPSynchronizeMembers = Synchronisation des membres du module adhérents de Dolibarr avec LDAP LDAPSynchronizeMembers = Organisation des objets adhérents dans le LDAP
LDAPTypeExample = OpenLdap, Egroupware ou Active Directory LDAPTypeExample = OpenLdap, Egroupware ou Active Directory
LDAPPrimaryServer = Serveur primaire LDAPPrimaryServer = Serveur primaire
LDAPSecondaryServer = Serveur secondaire LDAPSecondaryServer = Serveur secondaire