Fix: LDAP groups does not use sn, only cn
This commit is contained in:
parent
6362e57f2e
commit
9d6a69f6f3
@ -23,7 +23,7 @@
|
||||
/**
|
||||
* \file htdocs/admin/ldap_groups.php
|
||||
* \ingroup ldap
|
||||
* \brief Page d'administration/configuration du module Ldap
|
||||
* \brief Page to setup LDAP synchronization for groups
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
@ -54,7 +54,7 @@ if ($_GET["action"] == 'setvalue' && $user->admin)
|
||||
if (! dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS',$_POST["objectclass"],'chaine',0,'',$conf->entity)) $error++;
|
||||
|
||||
if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_FULLNAME',$_POST["fieldfullname"],'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_NAME',$_POST["fieldname"],'chaine',0,'',$conf->entity)) $error++;
|
||||
//if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_NAME',$_POST["fieldname"],'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_DESCRIPTION',$_POST["fielddescription"],'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPMEMBERS',$_POST["fieldgroupmembers"],'chaine',0,'',$conf->entity)) $error++;
|
||||
|
||||
@ -140,19 +140,20 @@ print '</tr>';
|
||||
|
||||
// Common name
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldCommonName").'</td><td>';
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldfullname" value="'.$conf->global->LDAP_GROUP_FIELD_FULLNAME.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldCommonNameExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_GROUP_FIELD_FULLNAME.'"'.($conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_FULLNAME?' checked="true"':'')."></td>";
|
||||
print '</tr>';
|
||||
|
||||
// Name
|
||||
$var=!$var;
|
||||
/*$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldName").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldname" value="'.$conf->global->LDAP_GROUP_FIELD_NAME.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldNameExample").'</td>';
|
||||
print '<td align="right"><input type="radio" name="key" value="'.$conf->global->LDAP_GROUP_FIELD_NAME.'"'.($conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_NAME?' checked="true"':'')."></td>";
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
// Description
|
||||
$var=!$var;
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* \defgroup ldap Module ldap
|
||||
* \brief Module pour interfacer les contacts avec un annuaire Ldap
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* \class modLdap
|
||||
* \brief Classe de description et activation du module Ldap
|
||||
*/
|
||||
@ -43,7 +43,7 @@ class modLdap extends DolibarrModules
|
||||
* \param DB handler d'acces base
|
||||
*/
|
||||
function modLdap($DB)
|
||||
{
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->numero = 200 ;
|
||||
|
||||
@ -75,12 +75,13 @@ class modLdap extends DolibarrModules
|
||||
4=>array('LDAP_GROUP_DN','chaine','ou=groups,dc=my-domain,dc=com','',0),
|
||||
5=>array('LDAP_FILTER_CONNECTION','chaine','&(objectClass=user)(objectCategory=person)','',0),
|
||||
6=>array('LDAP_FIELD_LOGIN','chaine','uid','',0),
|
||||
7=>array('LDAP_FIELD_NAME','chaine','sn','',0),
|
||||
8=>array('LDAP_FIELD_FIRSTNAME','chaine','givenname','',0),
|
||||
9=>array('LDAP_FIELD_MAIL','chaine','mail','',0),
|
||||
10=>array('LDAP_FIELD_PHONE','chaine','telephonenumber','',0),
|
||||
11=>array('LDAP_FIELD_FAX','chaine','facsimiletelephonenumber','',0),
|
||||
12=>array('LDAP_FIELD_MOBILE','chaine','mobile','',0),
|
||||
7=>array('LDAP_FIELD_FULLNAME','chaine','cn','',0),
|
||||
8=>array('LDAP_FIELD_NAME','chaine','sn','',0),
|
||||
9=>array('LDAP_FIELD_FIRSTNAME','chaine','givenname','',0),
|
||||
10=>array('LDAP_FIELD_MAIL','chaine','mail','',0),
|
||||
11=>array('LDAP_FIELD_PHONE','chaine','telephonenumber','',0),
|
||||
12=>array('LDAP_FIELD_FAX','chaine','facsimiletelephonenumber','',0),
|
||||
13=>array('LDAP_FIELD_MOBILE','chaine','mobile','',0),
|
||||
);
|
||||
|
||||
// Boites
|
||||
|
||||
@ -560,9 +560,9 @@ class UserGroup extends CommonObject
|
||||
|
||||
// Champs
|
||||
if ($this->nom && $conf->global->LDAP_GROUP_FIELD_FULLNAME) $info[$conf->global->LDAP_GROUP_FIELD_FULLNAME] = $this->nom;
|
||||
if ($this->nom && $conf->global->LDAP_GROUP_FIELD_NAME) $info[$conf->global->LDAP_GROUP_FIELD_NAME] = $this->nom;
|
||||
//if ($this->nom && $conf->global->LDAP_GROUP_FIELD_NAME) $info[$conf->global->LDAP_GROUP_FIELD_NAME] = $this->nom;
|
||||
if ($this->note && $conf->global->LDAP_GROUP_FIELD_DESCRIPTION) $info[$conf->global->LDAP_GROUP_FIELD_DESCRIPTION] = $this->note;
|
||||
if ($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)
|
||||
if ($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)
|
||||
{
|
||||
$valueofldapfield=array();
|
||||
foreach($this->members as $key=>$val)
|
||||
@ -570,7 +570,7 @@ class UserGroup extends CommonObject
|
||||
$muser=new User($this->db);
|
||||
$muser->id=$val;
|
||||
$muser->fetch();
|
||||
|
||||
|
||||
$ldapuserid=$muser->login;
|
||||
// TODO ldapuserid should depends on value $conf->global->LDAP_KEY_USERS;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user