diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 6cc42777343..7cb300b0384 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -245,6 +245,7 @@ print ''; print ''; +print '
'; /* diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 909364fb00e..b67fd7ae930 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Regis Houssin * Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2011 Juanjo Menent - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -49,7 +49,7 @@ if ($action == 'setvalue' && $user->admin) { $error=0; $db->begin(); - + if (! dolibarr_set_const($db, 'LDAP_USER_DN',GETPOST("user"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_USER_OBJECT_CLASS',GETPOST("objectclass"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FILTER_CONNECTION',GETPOST("filterconnection"),'chaine',0,'',$conf->entity)) $error++; @@ -249,7 +249,7 @@ print ''; // Description $var=!$var; -print ''.$langs->trans("LDAPFieldDescription").''; +print ''.$langs->trans("Note").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_DESCRIPTION)?' checked="checked"':'').">"; @@ -287,10 +287,19 @@ if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') show_ldap_test_button($butlabel,$testlabel,$key,$dn,$objectclass); } +elseif ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') +{ + $butlabel=$langs->trans("LDAPTestSearch"); + $testlabel='testsearchuser'; + $key=$conf->global->LDAP_KEY_USERS; + $dn=$conf->global->LDAP_USER_DN; + $objectclass=$conf->global->LDAP_USER_OBJECT_CLASS; + show_ldap_test_button($butlabel,$testlabel,$key,$dn,$objectclass); +} if (function_exists("ldap_connect")) { - if ($_GET["action"] == 'testuser') + if ($action == 'testuser') { // Creation objet $object=new User($db); @@ -339,6 +348,84 @@ if (function_exists("ldap_connect")) print $langs->trans("ErrorLDAPMakeManualTest",$conf->ldap->dir_temp).'
'; } } + + if ($action == 'testsearchuser') + { + // Creation objet + $object=new User($db); + $object->initAsSpecimen(); + + // TODO Mutualize code following with other ldap_xxxx.php pages + + // Test synchro + $ldap=new Ldap(); + $result=$ldap->connect_bind(); + + if ($result > 0) + { + $required_fields = array( + $conf->global->LDAP_KEY_USERS, + $conf->global->LDAP_FIELD_FULLNAME, + $conf->global->LDAP_FIELD_NAME, + $conf->global->LDAP_FIELD_FIRSTNAME, + $conf->global->LDAP_FIELD_LOGIN, + $conf->global->LDAP_FIELD_LOGIN_SAMBA, + $conf->global->LDAP_FIELD_PASSWORD, + $conf->global->LDAP_FIELD_PASSWORD_CRYPTED, + $conf->global->LDAP_FIELD_PHONE, + $conf->global->LDAP_FIELD_FAX, + $conf->global->LDAP_FIELD_MOBILE, + $conf->global->LDAP_FIELD_MAIL, + $conf->global->LDAP_FIELD_SID); + + // Remove from required_fields all entries not configured in LDAP (empty) and duplicated + $required_fields=array_unique(array_values(array_filter($required_fields, "dol_validElement"))); + + // Get from LDAP database an array of results + $ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1); + //$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, '', 1); + + if (is_array($ldapusers)) + { + $liste=array(); + foreach ($ldapusers as $key => $ldapuser) + { + // Define the label string for this user + $label=''; + foreach ($required_fields as $value) + { + if ($value) + { + $label.=$value."=".$ldapuser[$value]." "; + } + } + $liste[$key] = $label; + } + + } + else + { + $mesg='
'.$ldap->error.'
'; + } + + print "
\n"; + print "LDAP search for user:
\n"; + print "search: *
\n"; + print "userDN: ".$conf->global->LDAP_USER_DN."
\n"; + print "useridentifier: ".$conf->global->LDAP_KEY_USERS."
\n"; + print "required_fields: ".join(',',$required_fields)."
\n"; + print "=> ".count($liste)." records
\n"; + print "\n
"; + } + else + { + print img_picto('','error').' '; + print ''.$langs->trans("LDAPSynchroKO"); + print ': '.$ldap->error; + print '
'; + print $langs->trans("ErrorLDAPMakeManualTest",$conf->ldap->dir_temp).'
'; + } + } } dol_htmloutput_mesg($mesg); diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 9e06d62ff74..73304b232ee 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -169,7 +169,7 @@ class Ldap if ($this->serverType == "activedirectory") { $result=$this->setReferrals(); - dol_syslog("Ldap::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser,LOG_DEBUG); + dol_syslog(get_class($this)."::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser,LOG_DEBUG); $this->result=$this->bindauth($this->searchUser,$this->searchPassword); if ($this->result) { @@ -187,7 +187,7 @@ class Ldap // Try in auth mode if ($this->searchUser && $this->searchPassword) { - dol_syslog("Ldap::connect_bind try bindauth on ".$host." user=".$this->searchUser,LOG_DEBUG); + dol_syslog(get_class($this)."::connect_bind try bindauth on ".$host." user=".$this->searchUser,LOG_DEBUG); $this->result=$this->bindauth($this->searchUser,$this->searchPassword); if ($this->result) { @@ -203,7 +203,7 @@ class Ldap // Try in anonymous if (! $this->bind) { - dol_syslog("Ldap::connect_bind try bind on ".$host,LOG_DEBUG); + dol_syslog(get_class($this)."::connect_bind try bind on ".$host,LOG_DEBUG); $result=$this->bind(); if ($result) { @@ -225,13 +225,13 @@ class Ldap if ($connected) { $return=$connected; - dol_syslog("Ldap::connect_bind return=".$return, LOG_DEBUG); + dol_syslog(get_class($this)."::connect_bind return=".$return, LOG_DEBUG); } else { $this->error='Failed to connect to LDAP'.($this->error?': '.$this->error:''); $return=-1; - dol_syslog("Ldap::connect_bind return=".$return.' - '.$this->error, LOG_WARNING); + dol_syslog(get_class($this)."::connect_bind return=".$return.' - '.$this->error, LOG_WARNING); } return $return; } @@ -419,7 +419,7 @@ class Ldap { global $conf; - dol_syslog("Ldap::modify dn=".$dn." info=".join(',',$info)); + dol_syslog(get_class($this)."::modify dn=".$dn." info=".join(',',$info)); // Check parameters if (! $this->connection) @@ -447,13 +447,13 @@ class Ldap if ($result) { - dol_syslog("Ldap::modify successfull", LOG_DEBUG); + dol_syslog(get_class($this)."::modify successfull", LOG_DEBUG); return 1; } else { $this->error=@ldap_error($this->connection); - dol_syslog("Ldap::modify failed: ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::modify failed: ".$this->error, LOG_ERR); return -1; } } @@ -472,7 +472,7 @@ class Ldap { global $conf; - dol_syslog("Ldap::update dn=".$dn." olddn=".$olddn); + dol_syslog(get_class($this)."::update dn=".$dn." olddn=".$olddn); // Check parameters if (! $this->connection) @@ -501,13 +501,13 @@ class Ldap if ($result <= 0) { $this->error = ldap_errno($this->connection)." ".ldap_error($this->connection)." ".$this->error; - dol_syslog("Ldap::update ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); //print_r($info); return -1; } else { - dol_syslog("Ldap::update done successfully"); + dol_syslog(get_class($this)."::update done successfully"); return 1; } } @@ -524,7 +524,7 @@ class Ldap { global $conf; - dol_syslog("Ldap::delete Delete LDAP entry dn=".$dn); + dol_syslog(get_class($this)."::delete Delete LDAP entry dn=".$dn); // Check parameters if (! $this->connection) @@ -638,7 +638,7 @@ class Ldap { global $conf; - dol_syslog("Ldap::addAttribute dn=".$dn." info=".join(',',$info)); + dol_syslog(get_class($this)."::addAttribute dn=".$dn." info=".join(',',$info)); // Check parameters if (! $this->connection) @@ -666,13 +666,13 @@ class Ldap if ($result) { - dol_syslog("Ldap::add_attribute successfull", LOG_DEBUG); + dol_syslog(get_class($this)."::add_attribute successfull", LOG_DEBUG); return 1; } else { $this->error=@ldap_error($this->connection); - dol_syslog("Ldap::add_attribute failed: ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::add_attribute failed: ".$this->error, LOG_ERR); return -1; } } @@ -690,7 +690,7 @@ class Ldap { global $conf; - dol_syslog("Ldap::updateAttribute dn=".$dn." info=".join(',',$info)); + dol_syslog(get_class($this)."::updateAttribute dn=".$dn." info=".join(',',$info)); // Check parameters if (! $this->connection) @@ -718,13 +718,13 @@ class Ldap if ($result) { - dol_syslog("Ldap::updateAttribute successfull", LOG_DEBUG); + dol_syslog(get_class($this)."::updateAttribute successfull", LOG_DEBUG); return 1; } else { $this->error=@ldap_error($this->connection); - dol_syslog("Ldap::updateAttribute failed: ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::updateAttribute failed: ".$this->error, LOG_ERR); return -1; } } @@ -742,7 +742,7 @@ class Ldap { global $conf; - dol_syslog("Ldap::deleteAttribute dn=".$dn." info=".join(',',$info)); + dol_syslog(get_class($this)."::deleteAttribute dn=".$dn." info=".join(',',$info)); // Check parameters if (! $this->connection) @@ -770,13 +770,13 @@ class Ldap if ($result) { - dol_syslog("Ldap::deleteAttribute successfull", LOG_DEBUG); + dol_syslog(get_class($this)."::deleteAttribute successfull", LOG_DEBUG); return 1; } else { $this->error=@ldap_error($this->connection); - dol_syslog("Ldap::deleteAttribute failed: ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::deleteAttribute failed: ".$this->error, LOG_ERR); return -1; } } @@ -872,21 +872,21 @@ class Ldap * @param string $search Valeur champ cle recherche, sinon '*' pour tous. * @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org) * @param string $useridentifier Name of key field (Ex: uid) - * @param array $attributeArray Array of fields required (Ex: sn,userPassword) - * @param int $activefilter 1=utilise le champ this->filter comme filtre + * @param array $attributeArray Array of fields required. Note this array must also contains field $useridentifier (Ex: sn,userPassword) + * @param int $activefilter 1=use field this->filter as filter instead of parameter $search * @return array Array of [id_record][ldap_field]=value */ function getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter=0) { $fulllist=array(); - dol_syslog("Ldap::getRecords search=".$search." userDn=".$userDn." useridentifier=".$useridentifier." attributeArray=array(".join(',',$attributeArray).")"); + dol_syslog(get_class($this)."::getRecords search=".$search." userDn=".$userDn." useridentifier=".$useridentifier." attributeArray=array(".join(',',$attributeArray).")"); // if the directory is AD, then bind first with the search user first if ($this->serverType == "activedirectory") { $this->bindauth($this->searchUser, $this->searchPassword); - dol_syslog("Ldap::bindauth serverType=activedirectory searchUser=".$this->searchUser); + dol_syslog(get_class($this)."::bindauth serverType=activedirectory searchUser=".$this->searchUser); } // Define filter @@ -909,13 +909,15 @@ class Ldap if (is_array($attributeArray)) { // Return list with required fields - dol_syslog("Ldap::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter. " attributeArray=(".join(',',$attributeArray).")"); + $attributeArray=array_values($attributeArray); // This is to force to have index reordered from 0 (not make ldap_search fails) + dol_syslog(get_class($this)."::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter. " attributeArray=(".join(',',$attributeArray).")"); + //var_dump($attributeArray); $this->result = @ldap_search($this->connection, $userDn, $filter, $attributeArray); } else { // Return list with fields selected by default - dol_syslog("Ldap::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter); + dol_syslog(get_class($this)."::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter); $this->result = @ldap_search($this->connection, $userDn, $filter); } if (!$this->result) @@ -1073,7 +1075,7 @@ class Ldap */ function search($checkDn, $filter) { - dol_syslog("Ldap::search checkDn=".$checkDn." filter=".$filter); + dol_syslog(get_class($this)."::search checkDn=".$checkDn." filter=".$filter); $checkDn=$this->convFromOutputCharset($checkDn,$this->ldapcharset); $filter=$this->convFromOutputCharset($filter,$this->ldapcharset); @@ -1122,7 +1124,7 @@ class Ldap $i=0; while ($i <= 2) { - dol_syslog("Ldap::fetch search with searchDN=".$searchDN." filter=".$filter); + dol_syslog(get_class($this)."::fetch search with searchDN=".$searchDN." filter=".$filter); $this->result = @ldap_search($this->connection, $searchDN, $filter); if ($this->result) { @@ -1134,7 +1136,7 @@ class Ldap else { $this->error = ldap_errno($this->connection)." ".ldap_error($this->connection); - dol_syslog("Ldap::fetch search fails"); + dol_syslog(get_class($this)."::fetch search fails"); return -1; } diff --git a/htdocs/langs/el_GR/admin.lang b/htdocs/langs/el_GR/admin.lang index 6f38ed9ed82..ee159f0d689 100644 --- a/htdocs/langs/el_GR/admin.lang +++ b/htdocs/langs/el_GR/admin.lang @@ -487,12 +487,12 @@ LDAPServerUseTLS=Use TLS LDAPServerUseTLSExample=Your LDAP server use TLS LDAPServerDn=Server DN LDAPAdminDn=Administrator DN -LDAPAdminDnExample=Complete DN (ex: cn=adminldap,dc=society,dc=com) +LDAPAdminDnExample=Complete DN (ex: cn=admin,dc=example,dc=com) LDAPPassword=Administrator password LDAPUserDn=Users' DN -LDAPUserDnExample=Complete DN (ex: ou=users,dc=society,dc=com) +LDAPUserDnExample=Complete DN (ex: ou=users,dc=example,dc=com) LDAPGroupDn=Groups' DN -LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=society,dc=com) +LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=example,dc=com) LDAPServerExample=Server address (ex: localhost, 192.168.0.2, ldaps://ldap.example.com/) LDAPServerDnExample=Complete DN (ex: dc=company,dc=com) LDAPPasswordExample=Admin password @@ -504,9 +504,9 @@ LDAPDnContactActiveExample=Activated/Unactivated synchronization LDAPDnMemberActive=Members' synchronization LDAPDnMemberActiveExample=Activated/Unactivated synchronization LDAPContactDn=Dolibarr contacts' DN -LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=society,dc=com) +LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=example,dc=com) LDAPMemberDn=Dolibarr member's DN -LDAPMemberDnExample=Complete DN (ex: ou=members,dc=society,dc=com) +LDAPMemberDnExample=Complete DN (ex: ou=members,dc=example,dc=com) LDAPMemberObjectClassList=List of objectClass LDAPMemberObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory) LDAPUserObjectClassList=List of objectClass @@ -516,7 +516,7 @@ LDAPGroupObjectClassListExample=List of objectClass defining record attributes ( LDAPContactObjectClassList=List of objectClass LDAPContactObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory) LDAPMemberTypeDn=Dolibarr member's type DN -LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=society,dc=com) +LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=example,dc=com) LDAPTestConnect=Test LDAP connection LDAPTestSynchroContact=Test contact's synchronization LDAPTestSynchroUser=Test user's synchronization @@ -550,7 +550,7 @@ LDAPFieldCommonNameExample=Example : cn LDAPFieldName=Name LDAPFieldNameExample=Example : sn LDAPFieldFirstName=First name -LDAPFieldFirstNameExample=Example : givenname +LDAPFieldFirstNameExample=Example : givenName LDAPFieldMail=Email address LDAPFieldMailExample=Example : mail LDAPFieldPhone=Professional phone number diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b4d89c11055..efefb67f7ce 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1049,14 +1049,14 @@ LDAPServerUseTLS=Use TLS LDAPServerUseTLSExample=Your LDAP server use TLS LDAPServerDn=Server DN LDAPAdminDn=Administrator DN -LDAPAdminDnExample=Complete DN (ex: cn=adminldap,dc=society,dc=com) +LDAPAdminDnExample=Complete DN (ex: cn=admin,dc=example,dc=com) LDAPPassword=Administrator password LDAPUserDn=Users' DN -LDAPUserDnExample=Complete DN (ex: ou=users,dc=society,dc=com) +LDAPUserDnExample=Complete DN (ex: ou=users,dc=example,dc=com) LDAPGroupDn=Groups' DN -LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=society,dc=com) +LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=example,dc=com) LDAPServerExample=Server address (ex: localhost, 192.168.0.2, ldaps://ldap.example.com/) -LDAPServerDnExample=Complete DN (ex: dc=company,dc=com) +LDAPServerDnExample=Complete DN (ex: dc=example,dc=com) LDAPPasswordExample=Admin password LDAPDnSynchroActive=Users and groups synchronization LDAPDnSynchroActiveExample=LDAP to Dolibarr or Dolibarr to LDAP synchronization @@ -1066,9 +1066,9 @@ LDAPDnContactActiveExample=Activated/Unactivated synchronization LDAPDnMemberActive=Members' synchronization LDAPDnMemberActiveExample=Activated/Unactivated synchronization LDAPContactDn=Dolibarr contacts' DN -LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=society,dc=com) +LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=example,dc=com) LDAPMemberDn=Dolibarr members DN -LDAPMemberDnExample=Complete DN (ex: ou=members,dc=society,dc=com) +LDAPMemberDnExample=Complete DN (ex: ou=members,dc=example,dc=com) LDAPMemberObjectClassList=List of objectClass LDAPMemberObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory) LDAPUserObjectClassList=List of objectClass @@ -1078,12 +1078,13 @@ LDAPGroupObjectClassListExample=List of objectClass defining record attributes ( LDAPContactObjectClassList=List of objectClass LDAPContactObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory) LDAPMemberTypeDn=Dolibarr members type DN -LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=society,dc=com) +LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=example,dc=com) LDAPTestConnect=Test LDAP connection LDAPTestSynchroContact=Test contacts synchronization LDAPTestSynchroUser=Test user synchronization LDAPTestSynchroGroup=Test group synchronization LDAPTestSynchroMember=Test member synchronization +LDAPTestSearch= Test a LDAP search LDAPSynchroOK=Synchronization test successful LDAPSynchroKO=Failed synchronization test LDAPSynchroKOMayBePermissions=Failed synchronization test. Check that connexion to server is correctly configured and allows LDAP udpates @@ -1093,8 +1094,8 @@ LDAPBindOK=Connect/Authentificate to LDAP server sucessfull (Server=%s, Port=%s, LDAPBindKO=Connect/Authentificate to LDAP server failed (Server=%s, Port=%s, Admin=%s, Password=%s) LDAPUnbindSuccessfull=Disconnect successfull LDAPUnbindFailed=Disconnect failed -LDAPConnectToDNSuccessfull=Connection au DN (%s) r�ussie -LDAPConnectToDNFailed=Connection au DN (%s) �chou�e +LDAPConnectToDNSuccessfull=Connection to DN (%s) successful +LDAPConnectToDNFailed=Connection to DN (%s) failed LDAPSetupForVersion3=LDAP server configured for version 3 LDAPSetupForVersion2=LDAP server configured for version 2 LDAPDolibarrMapping=Dolibarr Mapping @@ -1105,7 +1106,7 @@ LDAPFilterConnection=Search filter LDAPFilterConnectionExample=Example : &(objectClass=inetOrgPerson) LDAPFieldLoginSamba=Login (samba, activedirectory) LDAPFieldLoginSambaExample=Example : samaccountname -LDAPFieldFullname=First name +LDAPFieldFullname=Full name LDAPFieldFullnameExample=Example : cn LDAPFieldPassword=Password LDAPFieldPasswordNotCrypted=Password not crypted @@ -1116,7 +1117,7 @@ LDAPFieldCommonNameExample=Example : cn LDAPFieldName=Name LDAPFieldNameExample=Example : sn LDAPFieldFirstName=First name -LDAPFieldFirstNameExample=Example : givenname +LDAPFieldFirstNameExample=Example : givenName LDAPFieldMail=Email address LDAPFieldMailExample=Example : mail LDAPFieldPhone=Professional phone number diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 64ced0b6cf8..deef7609e55 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1091,6 +1091,7 @@ LDAPTestSynchroContact= Tester synchronisation contacts LDAPTestSynchroUser= Tester synchronisation utilisateur LDAPTestSynchroGroup= Tester synchronisation groupe LDAPTestSynchroMember= Tester synchronisation adhérent +LDAPTestSearch= Tester une recherche LDAP LDAPSynchroOK= Test de synchronisation réalisé avec succès LDAPSynchroKO= Échec du test de synchronisation LDAPSynchroKOMayBePermissions= Echec du test de synchronisation. Vérifier que la connexion au serveur est correctement configurée et permet les mises à jour LDAP @@ -1123,7 +1124,7 @@ LDAPFieldCommonNameExample= Exemple : cn LDAPFieldName= Nom LDAPFieldNameExample= Exemple : sn LDAPFieldFirstName= Prénom -LDAPFieldFirstNameExample= Exemple : givenname +LDAPFieldFirstNameExample= Exemple : givenName LDAPFieldMail= Email LDAPFieldMailExample= Exemple : mail LDAPFieldPhone= Téléphone professionnel diff --git a/htdocs/langs/nb_NO/admin.lang b/htdocs/langs/nb_NO/admin.lang index d1735da5273..7a9ec630980 100644 --- a/htdocs/langs/nb_NO/admin.lang +++ b/htdocs/langs/nb_NO/admin.lang @@ -732,14 +732,14 @@ LDAPServerUseTLS=Use TLS LDAPServerUseTLSExample=Your LDAP server use TLS LDAPServerDn=Server DN LDAPAdminDn=Administrator DN -LDAPAdminDnExample=Complete DN (ex: cn=adminldap,dc=society,dc=com) +LDAPAdminDnExample=Complete DN (ex: cn=admin,dc=example,dc=com) LDAPPassword=Administrator password LDAPUserDn=Users' DN -LDAPUserDnExample=Complete DN (ex: ou=users,dc=society,dc=com) +LDAPUserDnExample=Complete DN (ex: ou=users,dc=example,dc=com) LDAPGroupDn=Groups' DN -LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=society,dc=com) +LDAPGroupDnExample=Complete DN (ex: ou=groups,dc=example,dc=com) LDAPServerExample=Server address (ex: localhost, 192.168.0.2, ldaps://ldap.example.com/) -LDAPServerDnExample=Complete DN (ex: dc=company,dc=com) +LDAPServerDnExample=Complete DN (ex: dc=example,dc=com) LDAPPasswordExample=Admin password LDAPDnSynchroActive=Users and groups synchronization LDAPDnSynchroActiveExample=LDAP to Dolibarr or Dolibarr to LDAP synchronization @@ -749,9 +749,9 @@ LDAPDnContactActiveExample=Activated/Unactivated synchronization LDAPDnMemberActive=Members' synchronization LDAPDnMemberActiveExample=Activated/Unactivated synchronization LDAPContactDn=Dolibarr contacts' DN -LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=society,dc=com) +LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=example,dc=com) LDAPMemberDn=Dolibarr members' DN -LDAPMemberDnExample=Complete DN (ex: ou=members,dc=society,dc=com) +LDAPMemberDnExample=Complete DN (ex: ou=members,dc=example,dc=com) LDAPMemberObjectClassList=List of objectClass LDAPMemberObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory) LDAPUserObjectClassList=List of objectClass @@ -761,7 +761,7 @@ LDAPGroupObjectClassListExample=List of objectClass defining record attributes ( LDAPContactObjectClassList=List of objectClass LDAPContactObjectClassListExample=List of objectClass defining record attributes (ex: top,inetOrgPerson or top,user for active directory) LDAPMemberTypeDn=Dolibarr member's type DN -LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=society,dc=com) +LDAPMemberTypeDnExample=Complete DN (ex: ou=type_members,dc=example,dc=com) LDAPTestConnect=Test LDAP connection LDAPTestSynchroContact=Test contact's synchronization LDAPTestSynchroUser=Test user's synchronization @@ -799,7 +799,7 @@ LDAPFieldCommonNameExample=Example : cn LDAPFieldName=Name LDAPFieldNameExample=Example : sn LDAPFieldFirstName=Firstname -LDAPFieldFirstNameExample=Example : givenname +LDAPFieldFirstNameExample=Example : givenName LDAPFieldMail=Email address LDAPFieldMailExample=Example : mail LDAPFieldPhone=Professional phone number diff --git a/htdocs/langs/sl_SI/admin.lang b/htdocs/langs/sl_SI/admin.lang index 0e6da5c4914..47b8ab80347 100644 --- a/htdocs/langs/sl_SI/admin.lang +++ b/htdocs/langs/sl_SI/admin.lang @@ -1046,7 +1046,7 @@ LDAPFieldCommonNameExample = Example : cn LDAPFieldName = Name LDAPFieldNameExample = Example : sn LDAPFieldFirstName = First name -LDAPFieldFirstNameExample = Example : givenname +LDAPFieldFirstNameExample = Example : givenName LDAPFieldMail = Email address LDAPFieldMailExample = Example : mail LDAPFieldPhone = Professional phone number diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 27d03b7be7a..3ff5c7bd8be 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -87,9 +87,6 @@ class User extends CommonObject var $photo; var $lang; - //! Liste des entrepots auquel a acces l'utilisateur - var $entrepots; - var $rights; // Array of permissions user->rights->permx var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */ private $_tab_loaded=array(); // Array of cache of already loaded permissions diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index d3c1c40e877..6a78003324d 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -350,7 +350,7 @@ if ($action == 'update' && ! $_POST["cancel"]) $message.='
'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'
'; } else - { + { $message.='
'.$edituser->error.'
'; } } @@ -462,6 +462,7 @@ if ($action == 'adduserldap') $selecteduser = $_POST['users']; $required_fields = array( + $conf->global->LDAP_KEY_USERS, $conf->global->LDAP_FIELD_NAME, $conf->global->LDAP_FIELD_FIRSTNAME, $conf->global->LDAP_FIELD_LOGIN, @@ -532,7 +533,7 @@ if (($action == 'create') || ($action == 'adduserldap')) print "
"; print "
"; - dol_htmloutput_errors($message); + dol_htmloutput_mesg($message); if (! empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')) { @@ -557,6 +558,7 @@ if (($action == 'create') || ($action == 'adduserldap')) // Get from LDAP database an array of results $ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1); + if (is_array($ldapusers)) { $liste=array(); @@ -586,27 +588,27 @@ if (($action == 'create') || ($action == 'adduserldap')) } // Si la liste des users est rempli, on affiche la liste deroulante - if (is_array($liste)) + print "\n\n\n"; + + print '
'; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("LDAPUsers"); + print ''; + print ''; + if (is_array($liste) && count($liste)) { - print "\n\n\n"; - - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("LDAPUsers"); - print ''; - print ''; print $form->selectarray('users', $liste, '', 1); - print ''; - print ''; - print '
'; - print ''; - - print "\n\n\n"; - print '
'; } + print '
'; + print ''; + print '
'; + print ''; + + print "\n\n\n"; + print '
'; } print '
'; diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 3ae7e7ee35b..4aee9cf42b0 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -220,7 +220,6 @@ function getUser($authentication,$id,$ref='',$ref_ext='') 'statut' => $user->statut, 'photo' => $user->photo, 'lang' => $user->lang, -'entrepots' => $user->entrepots, //'rights' => $user->rights, 'canvas' => $user->canvas )