forked from Wavyzz/dolibarr
Fix: A lot of fix on LDAP synchro.
This commit is contained in:
@@ -21,15 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/adherents/adherent.class.php
|
* \file htdocs/adherents/adherent.class.php
|
||||||
\ingroup adherent
|
* \ingroup adherent
|
||||||
\brief Fichier de la classe permettant la gestion d'un adherent
|
* \brief Fichier de la classe permettant la gestion d'un adherent
|
||||||
\author Rodolphe Qiedeville
|
* \version $Id$
|
||||||
\author Jean-Louis Bergamo
|
|
||||||
\author Laurent Destailleur
|
|
||||||
\author Sebastien Di Cintio
|
|
||||||
\author Benoit Mortier
|
|
||||||
\version $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
|
||||||
@@ -1923,8 +1918,8 @@ class Adherent extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
||||||
* \param info Info string loaded by _load_ldap_info
|
* \param info Info string loaded by _load_ldap_info
|
||||||
* \param mode 0=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
|
* \param mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
|
||||||
* 1=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
|
* 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
|
||||||
* 2=Return key only (uid=qqq)
|
* 2=Return key only (uid=qqq)
|
||||||
* \return string DN
|
* \return string DN
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -45,16 +45,6 @@ if ($user->societe_id > 0)
|
|||||||
$socid = $user->societe_id;
|
$socid = $user->societe_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Affichage page
|
|
||||||
*/
|
|
||||||
|
|
||||||
llxHeader();
|
|
||||||
|
|
||||||
$html = new Form($db);
|
|
||||||
|
|
||||||
|
|
||||||
$adh = new Adherent($db);
|
$adh = new Adherent($db);
|
||||||
$adh->id = $rowid;
|
$adh->id = $rowid;
|
||||||
$result=$adh->fetch($rowid);
|
$result=$adh->fetch($rowid);
|
||||||
@@ -75,17 +65,22 @@ if (! $result)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
|
$html = new Form($db);
|
||||||
|
|
||||||
$head = member_prepare_head($adh);
|
$head = member_prepare_head($adh);
|
||||||
|
|
||||||
dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user');
|
dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user');
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fiche en mode visu
|
|
||||||
*/
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@@ -129,7 +124,7 @@ $langs->load("admin");
|
|||||||
// LDAP DN
|
// LDAP DN
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPMemberDn").'</td><td class="valeur">'.$conf->global->LDAP_MEMBER_DN."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPMemberDn").'</td><td class="valeur">'.$conf->global->LDAP_MEMBER_DN."</td></tr>\n";
|
||||||
|
|
||||||
// LDAP Cl<EFBFBD>
|
// LDAP Cle
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur">'.$conf->global->LDAP_KEY_MEMBERS."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur">'.$conf->global->LDAP_KEY_MEMBERS."</td></tr>\n";
|
||||||
|
|
||||||
// LDAP Server
|
// LDAP Server
|
||||||
@@ -146,9 +141,10 @@ print '</div>';
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
print_titre($langs->trans("LDAPInformationsForThisMember"));
|
|
||||||
|
|
||||||
// Affichage attributs LDAP
|
// Affichage attributs LDAP
|
||||||
|
print_titre($langs->trans("LDAPInformationsForThisMember"));
|
||||||
|
|
||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|||||||
@@ -280,8 +280,9 @@ if (function_exists("ldap_connect"))
|
|||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result2=$ldap->update($dn,$info,$user);
|
$result1=$ldap->delete($dn); // To be sure to delete existing records
|
||||||
$result3=$ldap->delete($dn);
|
$result2=$ldap->add($dn,$info,$user); // Now the test
|
||||||
|
$result3=$ldap->delete($dn); // Clean what we did
|
||||||
|
|
||||||
if ($result2 > 0)
|
if ($result2 > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -202,8 +202,9 @@ if (function_exists("ldap_connect"))
|
|||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result2=$ldap->update($dn,$info,$user);
|
$result1=$ldap->delete($dn); // To be sure to delete existing records
|
||||||
$result3=$ldap->delete($dn);
|
$result2=$ldap->add($dn,$info,$user); // Now the test
|
||||||
|
$result3=$ldap->delete($dn); // Clean what we did
|
||||||
|
|
||||||
if ($result2 > 0)
|
if ($result2 > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -394,8 +394,9 @@ if (function_exists("ldap_connect"))
|
|||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result2=$ldap->update($dn,$info,$user);
|
$result1=$ldap->delete($dn); // To be sure to delete existing records
|
||||||
$result3=$ldap->delete($dn);
|
$result2=$ldap->add($dn,$info,$user); // Now the test
|
||||||
|
$result3=$ldap->delete($dn); // Clean what we did
|
||||||
|
|
||||||
if ($result2 > 0)
|
if ($result2 > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -296,8 +296,9 @@ if (function_exists("ldap_connect"))
|
|||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result2=$ldap->update($dn,$info,$user);
|
$result1=$ldap->delete($dn); // To be sure to delete existing records
|
||||||
$result3=$ldap->delete($dn);
|
$result2=$ldap->add($dn,$info,$user); // Now the test
|
||||||
|
$result3=$ldap->delete($dn); // Clean what we did
|
||||||
|
|
||||||
if ($result2 > 0)
|
if ($result2 > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -137,12 +137,14 @@ class Contact extends CommonObject
|
|||||||
* \param id Id du contact a mettre a jour
|
* \param id Id du contact a mettre a jour
|
||||||
* \param user Objet utilisateur qui effectue la mise a jour
|
* \param user Objet utilisateur qui effectue la mise a jour
|
||||||
* \param notrigger 0=non, 1=oui
|
* \param notrigger 0=non, 1=oui
|
||||||
* \return int <0 si erreur, >0 si ok
|
* \return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($id, $user=0, $notrigger=0)
|
function update($id, $user=0, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
|
||||||
// Nettoyage parametres
|
// Nettoyage parametres
|
||||||
@@ -155,6 +157,8 @@ class Contact extends CommonObject
|
|||||||
$this->phone_mobile=trim($this->phone_mobile);
|
$this->phone_mobile=trim($this->phone_mobile);
|
||||||
$this->fax=trim($this->fax);
|
$this->fax=trim($this->fax);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
|
||||||
if ($this->socid > 0) $sql .= " fk_soc='".addslashes($this->socid)."',";
|
if ($this->socid > 0) $sql .= " fk_soc='".addslashes($this->socid)."',";
|
||||||
if ($this->socid == -1) $sql .= " fk_soc=null,";
|
if ($this->socid == -1) $sql .= " fk_soc=null,";
|
||||||
@@ -179,14 +183,9 @@ class Contact extends CommonObject
|
|||||||
|
|
||||||
dol_syslog("Contact::update sql=".$sql,LOG_DEBUG);
|
dol_syslog("Contact::update sql=".$sql,LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if (! $result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror().' sql='.$sql;
|
if (! $error && ! $notrigger)
|
||||||
dol_syslog("Contact::update Error ".$this->error,LOG_ERR);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $notrigger)
|
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
@@ -196,15 +195,33 @@ class Contact extends CommonObject
|
|||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -$error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
$this->error=$this->db->lasterror().' sql='.$sql;
|
||||||
|
dol_syslog("Contact::update Error ".$this->error,LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
||||||
* \param info Info string loaded by _load_ldap_info
|
* \param info Info string loaded by _load_ldap_info
|
||||||
* \param mode 0=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
|
* \param mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
|
||||||
* 1=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
|
* 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
|
||||||
* 2=Return key only (uid=qqq)
|
* 2=Return key only (uid=qqq)
|
||||||
* \return string DN
|
* \return string DN
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2006 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2006 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -39,6 +39,11 @@ $contactid = isset($_GET["id"])?$_GET["id"]:'';
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'contact', $contactid, 'socpeople');
|
$result = restrictedArea($user, 'contact', $contactid, 'socpeople');
|
||||||
|
|
||||||
|
$contact = new Contact($db);
|
||||||
|
$contact->fetch($_GET["id"], $user);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@@ -48,18 +53,11 @@ llxHeader();
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$contact = new Contact($db);
|
|
||||||
$contact->fetch($_GET["id"], $user);
|
|
||||||
|
|
||||||
|
|
||||||
$head = contact_prepare_head($contact);
|
$head = contact_prepare_head($contact);
|
||||||
|
|
||||||
dol_fiche_head($head, 'ldap', $langs->trans("Contact"), 0, 'contact');
|
dol_fiche_head($head, 'ldap', $langs->trans("Contact"), 0, 'contact');
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fiche en mode visu
|
|
||||||
*/
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@@ -94,7 +92,7 @@ print '</td></tr>';
|
|||||||
// LDAP DN
|
// LDAP DN
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPContactDn").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_CONTACT_DN."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPContactDn").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_CONTACT_DN."</td></tr>\n";
|
||||||
|
|
||||||
// LDAP Cl<EFBFBD>
|
// LDAP Cle
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_KEY_CONTACTS."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_KEY_CONTACTS."</td></tr>\n";
|
||||||
|
|
||||||
// LDAP Server
|
// LDAP Server
|
||||||
@@ -109,9 +107,9 @@ print '</div>';
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
// Affichage attributs LDAP
|
||||||
print_titre($langs->trans("LDAPInformationsForThisContact"));
|
print_titre($langs->trans("LDAPInformationsForThisContact"));
|
||||||
|
|
||||||
// Affichage attributs LDAP
|
|
||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|||||||
@@ -135,10 +135,15 @@ class InterfaceLdapsynchro
|
|||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$ldap->connect_bind();
|
$ldap->connect_bind();
|
||||||
|
|
||||||
|
$oldobject=$object; // TODO Get oldobject
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error="ErrorLDAP"." ".$ldap->error;
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
@@ -200,10 +205,15 @@ class InterfaceLdapsynchro
|
|||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$ldap->connect_bind();
|
$ldap->connect_bind();
|
||||||
|
|
||||||
|
$oldobject=$object; // TODO Get oldobject
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error="ErrorLDAP"." ".$ldap->error;
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
@@ -258,10 +268,15 @@ class InterfaceLdapsynchro
|
|||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$ldap->connect_bind();
|
$ldap->connect_bind();
|
||||||
|
|
||||||
|
$oldobject=$object; // TODO Get oldobject
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error="ErrorLDAP"." ".$ldap->error;
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
@@ -320,10 +335,15 @@ class InterfaceLdapsynchro
|
|||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$ldap->connect_bind();
|
$ldap->connect_bind();
|
||||||
|
|
||||||
|
$oldobject=$object; // TODO Get oldobject
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error="ErrorLDAP"." ".$ldap->error;
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
@@ -347,10 +367,15 @@ class InterfaceLdapsynchro
|
|||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$ldap->connect_bind();
|
$ldap->connect_bind();
|
||||||
|
|
||||||
|
$oldobject=$object; // TODO Get oldobject
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error="ErrorLDAP"." ".$ldap->error;
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
@@ -367,10 +392,15 @@ class InterfaceLdapsynchro
|
|||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$ldap->connect_bind();
|
$ldap->connect_bind();
|
||||||
|
|
||||||
|
$oldobject=$object; // TODO Get oldobject
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error="ErrorLDAP"." ".$ldap->error;
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
@@ -412,10 +442,15 @@ class InterfaceLdapsynchro
|
|||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$ldap->connect_bind();
|
$ldap->connect_bind();
|
||||||
|
|
||||||
|
$oldobject=$object; // TODO Get oldobject
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$object->_load_ldap_info();
|
$info=$object->_load_ldap_info();
|
||||||
$dn=$object->_load_ldap_dn($info);
|
$dn=$object->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error="ErrorLDAP"." ".$ldap->error;
|
$this->error="ErrorLDAP"." ".$ldap->error;
|
||||||
|
|||||||
@@ -23,5 +23,6 @@ LDAPFieldLastSubscriptionDate=Last subscription date
|
|||||||
LDAPFieldLastSubscriptionAmount=Last subscription amount
|
LDAPFieldLastSubscriptionAmount=Last subscription amount
|
||||||
SynchronizeDolibarr2Ldap=Synchronize user (Dolibarr -> LDAP)
|
SynchronizeDolibarr2Ldap=Synchronize user (Dolibarr -> LDAP)
|
||||||
UserSynchronized=User synchronized
|
UserSynchronized=User synchronized
|
||||||
|
GroupSynchronized=Group synchronized
|
||||||
ForceSynchronize=Force synchronizing Dolibarr -> LDAP
|
ForceSynchronize=Force synchronizing Dolibarr -> LDAP
|
||||||
ErrorFailedToReadLDAP=Failed to read LDAP database. Check LDAP module setup and database accessibility.
|
ErrorFailedToReadLDAP=Failed to read LDAP database. Check LDAP module setup and database accessibility.
|
||||||
@@ -23,5 +23,6 @@ LDAPFieldLastSubscriptionDate=Date dernière adhésion
|
|||||||
LDAPFieldLastSubscriptionAmount=Montant dernière adhésion
|
LDAPFieldLastSubscriptionAmount=Montant dernière adhésion
|
||||||
SynchronizeDolibarr2Ldap=Synchroniser utilisateur (Dolibarr -> LDAP)
|
SynchronizeDolibarr2Ldap=Synchroniser utilisateur (Dolibarr -> LDAP)
|
||||||
UserSynchronized=Utilisateur synchronisé
|
UserSynchronized=Utilisateur synchronisé
|
||||||
|
GroupSynchronized=Groupe synchronisé
|
||||||
ForceSynchronize=Forcer synchro Dolibarr -> LDAP
|
ForceSynchronize=Forcer synchro Dolibarr -> LDAP
|
||||||
ErrorFailedToReadLDAP=Echec de la lecture de l'annuaire LDAP. Vérifier la configuration du module LDAP et l'accessibilité de l'annuaire.
|
ErrorFailedToReadLDAP=Echec de la lecture de l'annuaire LDAP. Vérifier la configuration du module LDAP et l'accessibilité de l'annuaire.
|
||||||
@@ -2620,11 +2620,11 @@ function dol_entity_decode($stringhtml,$pagecodeto='UTF-8')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Check if a string is a correct iso string
|
* \brief Check if a string is a correct iso string
|
||||||
If not, it will we considered not HTML encoded even if it is by FPDF.
|
* If not, it will we considered not HTML encoded even if it is by FPDF.
|
||||||
\remarks Example, if string contains euro symbol that has ascii code 128.
|
* \remarks Example, if string contains euro symbol that has ascii code 128.
|
||||||
\param s String to check
|
* \param s String to check
|
||||||
\return int 0 if bad iso, 1 if good iso
|
* \return int 0 if bad iso, 1 if good iso
|
||||||
*/
|
*/
|
||||||
function dol_string_is_good_iso($s)
|
function dol_string_is_good_iso($s)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -388,50 +388,6 @@ class Ldap
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Mise <20> jour dans l'arbre LDAP
|
|
||||||
* \param dn DN
|
|
||||||
* \param info Tableau info
|
|
||||||
* \param user Objet user qui fait l'op<6F>ration
|
|
||||||
* \return int <0 si ko, >0 si ok
|
|
||||||
* \remarks Ldap object connect and bind must have been done
|
|
||||||
*/
|
|
||||||
function update($dn,$info,$user,$olddn='')
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
if (! $this->connection)
|
|
||||||
{
|
|
||||||
$this->error=$langs->trans("NotConnected");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (! $this->bind)
|
|
||||||
{
|
|
||||||
$this->error=$langs->trans("NotConnected");
|
|
||||||
return -3;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $olddn) $olddn=$dn;
|
|
||||||
|
|
||||||
dol_syslog("Ldap::update dn=".$dn." olddn=".$olddn);
|
|
||||||
|
|
||||||
// On supprime et on ins<6E>re
|
|
||||||
$result = $this->delete($olddn);
|
|
||||||
$result = $this->add($dn, $info, $user);
|
|
||||||
if ($result <= 0)
|
|
||||||
{
|
|
||||||
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection)." ".$this->error;
|
|
||||||
dol_syslog("Ldap::update ".$this->error,LOG_ERR);
|
|
||||||
//print_r($info);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_syslog("Ldap::update done successfully");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Checks a username and password - does this by logging on to the
|
* \brief Checks a username and password - does this by logging on to the
|
||||||
@@ -482,8 +438,9 @@ class Ldap
|
|||||||
* \brief Add a LDAP entry
|
* \brief Add a LDAP entry
|
||||||
* \param dn DN entry key
|
* \param dn DN entry key
|
||||||
* \param info Attributes array
|
* \param info Attributes array
|
||||||
* \param user Objet utilisateru qui cr<63>e
|
* \param user Objet user that create
|
||||||
* \return int <0 si KO, >0 si OK
|
* \return int <0 if KO, >0 if OK
|
||||||
|
* \remarks Ldap object connect and bind must have been done
|
||||||
*/
|
*/
|
||||||
function add($dn, $info, $user)
|
function add($dn, $info, $user)
|
||||||
{
|
{
|
||||||
@@ -491,6 +448,18 @@ class Ldap
|
|||||||
|
|
||||||
dol_syslog("Ldap::add dn=".$dn." info=".join(',',$info));
|
dol_syslog("Ldap::add dn=".$dn." info=".join(',',$info));
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (! $this->connection)
|
||||||
|
{
|
||||||
|
$this->error="NotConnected";
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
if (! $this->bind)
|
||||||
|
{
|
||||||
|
$this->error="NotConnected";
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
// Encode to LDAP page code
|
// Encode to LDAP page code
|
||||||
$dn=$this->convFromOutputCharset($dn,$this->ldapcharset);
|
$dn=$this->convFromOutputCharset($dn,$this->ldapcharset);
|
||||||
foreach($info as $key => $val)
|
foreach($info as $key => $val)
|
||||||
@@ -516,10 +485,116 @@ class Ldap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Modify a LDAP entry
|
||||||
|
* \param dn DN entry key
|
||||||
|
* \param info Attributes array
|
||||||
|
* \param user Objet user that modify
|
||||||
|
* \return int <0 if KO, >0 if OK
|
||||||
|
* \remarks Ldap object connect and bind must have been done
|
||||||
|
*/
|
||||||
|
function modify($dn, $info, $user)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
dol_syslog("Ldap::modify dn=".$dn." info=".join(',',$info));
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (! $this->connection)
|
||||||
|
{
|
||||||
|
$this->error="NotConnected";
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
if (! $this->bind)
|
||||||
|
{
|
||||||
|
$this->error="NotConnected";
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encode to LDAP page code
|
||||||
|
$dn=$this->convFromOutputCharset($dn,$this->ldapcharset);
|
||||||
|
foreach($info as $key => $val)
|
||||||
|
{
|
||||||
|
if (! is_array($val)) $info[$key]=$this->convFromOutputCharset($val,$this->ldapcharset);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->dump($dn,$info);
|
||||||
|
|
||||||
|
//print_r($info);
|
||||||
|
$result=@ldap_modify($this->connection, $dn, $info);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
dol_syslog("Ldap::modify successfull", LOG_DEBUG);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=@ldap_error($this->connection);
|
||||||
|
dol_syslog("Ldap::modify failed: ".$this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Modify a LDAP entry (to use if dn != olddn)
|
||||||
|
* \param dn DN entry key
|
||||||
|
* \param info Attributes array
|
||||||
|
* \param user Objet user that delete
|
||||||
|
* \param olddn Old DN entry key (before update)
|
||||||
|
* \return int <0 if KO, >0 if OK
|
||||||
|
* \remarks Ldap object connect and bind must have been done
|
||||||
|
*/
|
||||||
|
function update($dn,$info,$user,$olddn)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
dol_syslog("Ldap::update dn=".$dn." olddn=".$olddn);
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (! $this->connection)
|
||||||
|
{
|
||||||
|
$this->error="NotConnected";
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
if (! $this->bind)
|
||||||
|
{
|
||||||
|
$this->error="NotConnected";
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $olddn || $olddn != $dn)
|
||||||
|
{
|
||||||
|
// This case is not used for the moment
|
||||||
|
$result = $this->add($dn, $info, $user);
|
||||||
|
if ($result > 0 && $olddn && $olddn != $dn) $result = $this->delete($olddn); // If add fails, we do not try to delete old one
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result = $this->delete($olddn);
|
||||||
|
$result = $this->add($dn, $info, $user);
|
||||||
|
//$result = $this->modify($dn, $info, $user); // TODO Must use modify instead of delete/add when olddn is received (for the moment olddn is dn)
|
||||||
|
}
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection)." ".$this->error;
|
||||||
|
dol_syslog("Ldap::update ".$this->error,LOG_ERR);
|
||||||
|
//print_r($info);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("Ldap::update done successfully");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Delete a LDAP entry
|
* \brief Delete a LDAP entry
|
||||||
* \param dn DN entry key
|
* \param dn DN entry key
|
||||||
* \return int <0 si KO, >0 si OK
|
* \return int <0 si KO, >0 si OK
|
||||||
|
* \remarks Ldap object connect and bind must have been done
|
||||||
*/
|
*/
|
||||||
function delete($dn)
|
function delete($dn)
|
||||||
{
|
{
|
||||||
@@ -527,6 +602,18 @@ class Ldap
|
|||||||
|
|
||||||
dol_syslog("Ldap::delete Delete LDAP entry dn=".$dn);
|
dol_syslog("Ldap::delete Delete LDAP entry dn=".$dn);
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (! $this->connection)
|
||||||
|
{
|
||||||
|
$this->error="NotConnected";
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
if (! $this->bind)
|
||||||
|
{
|
||||||
|
$this->error="NotConnected";
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
// Encode to LDAP page code
|
// Encode to LDAP page code
|
||||||
$dn=$this->convFromOutputCharset($dn,$this->ldapcharset);
|
$dn=$this->convFromOutputCharset($dn,$this->ldapcharset);
|
||||||
|
|
||||||
|
|||||||
@@ -153,8 +153,9 @@ function show_ldap_content($result,$level,$count,$var,$hide=0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($hide) print eregi_replace('.','*',$val);
|
$newstring=@htmlentities($val,ENT_COMPAT,'UTF-8'); // Make entity encoding
|
||||||
else print $val;
|
if ($hide) print eregi_replace('.','*',$newstring);
|
||||||
|
else print $newstring;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1566,8 +1566,8 @@ class User extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
||||||
* \param info Info string loaded by _load_ldap_info
|
* \param info Info string loaded by _load_ldap_info
|
||||||
* \param mode 0=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
|
* \param mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
|
||||||
* 1=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
|
* 1=
|
||||||
* 2=Return key only (uid=qqq)
|
* 2=Return key only (uid=qqq)
|
||||||
* \return string DN
|
* \return string DN
|
||||||
*/
|
*/
|
||||||
@@ -1581,6 +1581,11 @@ class User extends CommonObject
|
|||||||
return $dn;
|
return $dn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Initialise tableau info (tableau des attributs LDAP)
|
||||||
|
* \return array Tableau info des attributs
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Initialise tableau info (tableau des attributs LDAP)
|
* \brief Initialise tableau info (tableau des attributs LDAP)
|
||||||
|
|||||||
@@ -144,8 +144,8 @@ if ($_POST["action"] == 'update')
|
|||||||
$editgroup = new Usergroup($db, $_GET["id"]);
|
$editgroup = new Usergroup($db, $_GET["id"]);
|
||||||
$editgroup->fetch($_GET["id"]);
|
$editgroup->fetch($_GET["id"]);
|
||||||
|
|
||||||
$editgroup->nom = $_POST["group"];
|
$editgroup->nom = trim($_POST["group"]);
|
||||||
$editgroup->note = $_POST["note"];
|
$editgroup->note = dol_htmlcleanlastbr($_POST["note"]);
|
||||||
|
|
||||||
$ret=$editgroup->update();
|
$ret=$editgroup->update();
|
||||||
|
|
||||||
|
|||||||
@@ -42,33 +42,62 @@ if ($user->societe_id > 0)
|
|||||||
$socid = $user->societe_id;
|
$socid = $user->societe_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Affichage page
|
|
||||||
*/
|
|
||||||
|
|
||||||
llxHeader();
|
|
||||||
|
|
||||||
$form = new Form($db);
|
|
||||||
|
|
||||||
$fgroup = new Usergroup($db, $_GET["id"]);
|
$fgroup = new Usergroup($db, $_GET["id"]);
|
||||||
$fgroup->fetch($_GET["id"]);
|
$fgroup->fetch($_GET["id"]);
|
||||||
$fgroup->getrights();
|
$fgroup->getrights();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Actions
|
||||||
*/
|
*/
|
||||||
$head = group_prepare_head($fgroup);
|
|
||||||
|
|
||||||
dol_fiche_head($head, 'ldap', $langs->trans("Group"));
|
if ($_GET["action"] == 'dolibarr2ldap')
|
||||||
|
{
|
||||||
|
$message="";
|
||||||
|
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$ldap=new Ldap();
|
||||||
|
$result=$ldap->connect_bind();
|
||||||
|
|
||||||
|
$oldobject=$fgroup; // TODO Get oldobject
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
|
$info=$fgroup->_load_ldap_info();
|
||||||
|
$dn=$fgroup->_load_ldap_dn($info);
|
||||||
|
$result=$ldap->add($dn,$info,$user);
|
||||||
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
|
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
$message.='<div class="ok">'.$langs->trans("GroupSynchronized").'</div>';
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message.='<div class="error">'.$ldap->error.'</div>';
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fiche en mode visu
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
|
$head = group_prepare_head($fgroup);
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'ldap', $langs->trans("Group"));
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@@ -97,7 +126,7 @@ $langs->load("admin");
|
|||||||
// LDAP DN
|
// LDAP DN
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPGroupDn").'</td><td class="valeur">'.$conf->global->LDAP_GROUP_DN."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPGroupDn").'</td><td class="valeur">'.$conf->global->LDAP_GROUP_DN."</td></tr>\n";
|
||||||
|
|
||||||
// LDAP Cl<EFBFBD>
|
// LDAP Cle
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur">'.$conf->global->LDAP_KEY_GROUPS."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur">'.$conf->global->LDAP_KEY_GROUPS."</td></tr>\n";
|
||||||
|
|
||||||
// LDAP Server
|
// LDAP Server
|
||||||
@@ -109,12 +138,29 @@ print "</table>\n";
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<br>';
|
if ($message) { print $message; }
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Barre d'actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
|
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$fgroup->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</div>\n";
|
||||||
|
|
||||||
|
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
print_titre($langs->trans("LDAPInformationsForThisGroup"));
|
|
||||||
|
|
||||||
// Affichage attributs LDAP
|
// Affichage attributs LDAP
|
||||||
|
print_titre($langs->trans("LDAPInformationsForThisGroup"));
|
||||||
|
|
||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|||||||
@@ -61,9 +61,15 @@ if ($_GET["action"] == 'dolibarr2ldap')
|
|||||||
$ldap=new Ldap();
|
$ldap=new Ldap();
|
||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
|
|
||||||
|
$oldobject=$fuser; // TODO Get oldobject
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$fuser->_load_ldap_info();
|
$info=$fuser->_load_ldap_info();
|
||||||
$dn=$fuser->_load_ldap_dn($info);
|
$dn=$fuser->_load_ldap_dn($info);
|
||||||
$result=$ldap->update($dn,$info,$user); // Marche en creation LDAP et mise a jour
|
$result=$ldap->add($dn,$info,$user);
|
||||||
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
@@ -146,7 +152,7 @@ if ($conf->global->LDAP_SERVER_TYPE == "activedirectory")
|
|||||||
// LDAP DN
|
// LDAP DN
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPUserDn").'</td><td class="valeur">'.$conf->global->LDAP_USER_DN."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPUserDn").'</td><td class="valeur">'.$conf->global->LDAP_USER_DN."</td></tr>\n";
|
||||||
|
|
||||||
// LDAP Cl<EFBFBD>
|
// LDAP Cle
|
||||||
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur">'.$conf->global->LDAP_KEY_USERS."</td></tr>\n";
|
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur">'.$conf->global->LDAP_KEY_USERS."</td></tr>\n";
|
||||||
|
|
||||||
// LDAP Server
|
// LDAP Server
|
||||||
|
|||||||
@@ -525,8 +525,8 @@ class UserGroup extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
||||||
* \param info Info string loaded by _load_ldap_info
|
* \param info Info string loaded by _load_ldap_info
|
||||||
* \param mode 0=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
|
* \param mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
|
||||||
* 1=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
|
* 1=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
|
||||||
* 2=Return key only (uid=qqq)
|
* 2=Return key only (uid=qqq)
|
||||||
* \return string DN
|
* \return string DN
|
||||||
*/
|
*/
|
||||||
@@ -534,7 +534,7 @@ class UserGroup extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
$dn='';
|
$dn='';
|
||||||
if ($mode==0) $dn=$conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS].",".$conf->global->LDAP_USER_DN;
|
if ($mode==0) $dn=$conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS].",".$conf->global->LDAP_GROUP_DN;
|
||||||
if ($mode==1) $dn=$conf->global->LDAP_GROUP_DN;
|
if ($mode==1) $dn=$conf->global->LDAP_GROUP_DN;
|
||||||
if ($mode==2) $dn=$conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS];
|
if ($mode==2) $dn=$conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS];
|
||||||
return $dn;
|
return $dn;
|
||||||
|
|||||||
@@ -122,10 +122,16 @@ if ($resql)
|
|||||||
|
|
||||||
print $langs->transnoentities("UpdateMember")." rowid=".$member->id." ".$member->fullname;
|
print $langs->transnoentities("UpdateMember")." rowid=".$member->id." ".$member->fullname;
|
||||||
|
|
||||||
|
$oldobject=$member;
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$member->_load_ldap_info();
|
$info=$member->_load_ldap_info();
|
||||||
$dn=$member->_load_ldap_dn($info);
|
$dn=$member->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->add($dn,$info,$user); // Wil fail if already exists
|
||||||
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
print " - ".$langs->transnoentities("OK");
|
print " - ".$langs->transnoentities("OK");
|
||||||
|
|||||||
@@ -86,10 +86,16 @@ if ($resql)
|
|||||||
|
|
||||||
print $langs->trans("UpdateContact")." rowid=".$contact->id." ".$contact->getFullName($langs);
|
print $langs->trans("UpdateContact")." rowid=".$contact->id." ".$contact->getFullName($langs);
|
||||||
|
|
||||||
|
$oldobject=$contact;
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$contact->_load_ldap_info();
|
$info=$contact->_load_ldap_info();
|
||||||
$dn=$contact->_load_ldap_dn($info);
|
$dn=$contact->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->add($dn,$info,$user); // Wil fail if already exists
|
||||||
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
print " - ".$langs->trans("OK");
|
print " - ".$langs->trans("OK");
|
||||||
|
|||||||
@@ -87,10 +87,16 @@ if ($resql)
|
|||||||
|
|
||||||
print $langs->trans("UpdateGroup")." rowid=".$fgroup->id." ".$fgroup->nom;
|
print $langs->trans("UpdateGroup")." rowid=".$fgroup->id." ".$fgroup->nom;
|
||||||
|
|
||||||
|
$oldobject=$fgroup;
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$fgroup->_load_ldap_info();
|
$info=$fgroup->_load_ldap_info();
|
||||||
$dn=$fgroup->_load_ldap_dn($info);
|
$dn=$fgroup->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->add($dn,$info,$user); // Wil fail if already exists
|
||||||
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
print " - ".$langs->trans("OK");
|
print " - ".$langs->trans("OK");
|
||||||
|
|||||||
@@ -87,10 +87,16 @@ if ($resql)
|
|||||||
|
|
||||||
print $langs->trans("UpdateUser")." rowid=".$fuser->id." ".$fuser->fullname;
|
print $langs->trans("UpdateUser")." rowid=".$fuser->id." ".$fuser->fullname;
|
||||||
|
|
||||||
|
$oldobject=$fuser;
|
||||||
|
|
||||||
|
$oldinfo=$oldobject->_load_ldap_info();
|
||||||
|
$olddn=$oldobject->_load_ldap_dn($oldinfo);
|
||||||
|
|
||||||
$info=$fuser->_load_ldap_info();
|
$info=$fuser->_load_ldap_info();
|
||||||
$dn=$fuser->_load_ldap_dn($info);
|
$dn=$fuser->_load_ldap_dn($info);
|
||||||
|
|
||||||
$result=$ldap->update($dn,$info,$user);
|
$result=$ldap->add($dn,$info,$user); // Wil fail if already exists
|
||||||
|
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
print " - ".$langs->trans("OK");
|
print " - ".$langs->trans("OK");
|
||||||
|
|||||||
Reference in New Issue
Block a user