44 public $errors = array();
116 public $ldapcharset =
'UTF-8';
152 if (!empty($conf->global->LDAP_SERVER_HOST)) {
153 $this->server[] = $conf->global->LDAP_SERVER_HOST;
155 if (!empty($conf->global->LDAP_SERVER_HOST_SLAVE)) {
156 $this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE;
199 global $dolibarr_main_auth_ldap_debug;
204 $this->connectedServer =
'';
206 $ldapdebug = ((empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug ==
"false") ?
false :
true);
209 dol_syslog(get_class($this).
"::connect_bind");
210 print
"DEBUG: connect_bind<br>\n";
214 if (count($this->server) == 0 || empty($this->server[0])) {
215 $this->error =
'LDAP setup (file conf.php) is not complete';
216 dol_syslog(get_class($this).
"::connect_bind ".$this->error, LOG_WARNING);
220 if (!function_exists(
"ldap_connect")) {
221 $this->error =
'LDAPFunctionsNotAvailableOnPHP';
222 dol_syslog(get_class($this).
"::connect_bind ".$this->error, LOG_WARNING);
226 if (empty($this->error)) {
228 foreach ($this->server as $host) {
236 if ($this->
serverPing($host, $this->serverPort) ===
true) {
238 dol_syslog(get_class($this).
"::connect_bind serverPing true, we try ldap_connect to ".$host);
240 $this->connection = ldap_connect($host, $this->serverPort);
242 if (preg_match(
'/^ldaps/i', $host)) {
246 dol_syslog(get_class($this).
"::connect_bind serverPing false, we try ldap_connect to ".$host);
248 $this->connection = ldap_connect($host, $this->serverPort);
254 if (is_resource($this->connection) || is_object($this->connection)) {
256 dol_syslog(get_class($this).
"::connect_bind this->connection is ok", LOG_DEBUG);
260 if (!empty($conf->global->LDAP_SERVER_USE_TLS)) {
266 $resulttls = ldap_start_tls($this->connection);
268 dol_syslog(get_class($this).
"::connect_bind failed to start tls", LOG_WARNING);
269 $this->error =
'ldap_start_tls Failed to start TLS '.ldap_errno($this->connection).
' '.ldap_error($this->connection);
277 ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0);
280 if ($this->serverType ==
"activedirectory") {
282 dol_syslog(get_class($this).
"::connect_bind try bindauth for activedirectory on ".$host.
" user=".$this->searchUser.
" password=".preg_replace(
'/./',
'*', $this->searchPassword), LOG_DEBUG);
283 $this->result = $this->
bindauth($this->searchUser, $this->searchPassword);
287 $this->connectedServer = $host;
290 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
294 if ($this->searchUser && $this->searchPassword) {
295 dol_syslog(get_class($this).
"::connect_bind try bindauth on ".$host.
" user=".$this->searchUser.
" password=".preg_replace(
'/./',
'*', $this->searchPassword), LOG_DEBUG);
296 $this->result = $this->
bindauth($this->searchUser, $this->searchPassword);
300 $this->connectedServer = $host;
303 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
308 dol_syslog(get_class($this).
"::connect_bind try bind anonymously on ".$host, LOG_DEBUG);
313 $this->connectedServer = $host;
316 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
329 $return = $connected;
330 dol_syslog(get_class($this).
"::connect_bind return=".$return, LOG_DEBUG);
332 $this->error =
'Failed to connect to LDAP'.($this->error ?
': '.$this->error :
'');
334 dol_syslog(get_class($this).
"::connect_bind return=".$return.
' - '.$this->error, LOG_WARNING);
361 if (!$this->result = @ldap_bind($this->connection)) {
362 $this->ldapErrorCode = ldap_errno($this->connection);
363 $this->ldapErrorText = ldap_error($this->connection);
383 if (!$this->result = @ldap_bind($this->connection, $bindDn, $pass)) {
384 $this->ldapErrorCode = ldap_errno($this->connection);
385 $this->ldapErrorText = ldap_error($this->connection);
401 $this->result =
true;
402 if (is_resource($this->connection) || is_object($this->connection)) {
403 $this->result = @ldap_unbind($this->connection);
421 $version = @ldap_get_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $version);
433 $ldapsetversion = ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldapProtocolVersion);
434 return $ldapsetversion;
445 $ldapreferrals = ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0);
446 return $ldapreferrals;
461 dol_syslog(get_class($this).
"::add dn=".
$dn.
" info=".json_encode($info));
464 if (!$this->connection) {
465 $this->error =
"NotConnected";
469 $this->error =
"NotConnected";
475 foreach ($info as $key => $val) {
476 if (!is_array($val)) {
484 $result = @ldap_add($this->connection,
$dn, $info);
487 dol_syslog(get_class($this).
"::add successfull", LOG_DEBUG);
490 $this->ldapErrorCode = @ldap_errno($this->connection);
491 $this->ldapErrorText = @ldap_error($this->connection);
493 dol_syslog(get_class($this).
"::add failed: ".$this->error, LOG_ERR);
509 dol_syslog(get_class($this).
"::modify dn=".
$dn.
" info=".join(
',', $info));
512 if (!$this->connection) {
513 $this->error =
"NotConnected";
517 $this->error =
"NotConnected";
523 foreach ($info as $key => $val) {
524 if (!is_array($val)) {
534 if ($this->serverType ==
"activedirectory") {
538 if (isset($info[
'unicodePwd'])) {
539 $info[
'unicodePwd'] = mb_convert_encoding(
"\"".$info[
'unicodePwd'].
"\"",
"UTF-16LE",
"UTF-8");
542 $result = @ldap_modify($this->connection,
$dn, $info);
545 dol_syslog(get_class($this).
"::modify successfull", LOG_DEBUG);
548 $this->error = @ldap_error($this->connection);
549 dol_syslog(get_class($this).
"::modify failed: ".$this->error, LOG_ERR);
565 public function rename(
$dn, $newrdn, $newparent, $user, $deleteoldrdn =
true)
567 dol_syslog(get_class($this).
"::modify dn=".
$dn.
" newrdn=".$newrdn.
" newparent=".$newparent.
" deleteoldrdn=".($deleteoldrdn ? 1 : 0));
570 if (!$this->connection) {
571 $this->error =
"NotConnected";
575 $this->error =
"NotConnected";
585 $result = @ldap_rename($this->connection,
$dn, $newrdn, $newparent, $deleteoldrdn);
588 dol_syslog(get_class($this).
"::rename successfull", LOG_DEBUG);
591 $this->error = @ldap_error($this->connection);
592 dol_syslog(get_class($this).
"::rename failed: ".$this->error, LOG_ERR);
609 public function update(
$dn, $info, $user, $olddn, $newrdn =
false, $newparent =
false)
611 dol_syslog(get_class($this).
"::update dn=".
$dn.
" olddn=".$olddn);
614 if (!$this->connection) {
615 $this->error =
"NotConnected";
619 $this->error =
"NotConnected";
623 if (!$olddn || $olddn !=
$dn) {
624 if (!empty($olddn) && !empty($newrdn) && !empty($newparent) && $this->ldapProtocolVersion ===
'3') {
626 $result = $this->
rename($olddn, $newrdn, $newparent, $user,
true);
632 $result = $this->
delete($olddn);
641 $this->error = ldap_error($this->connection).
' (Code '.ldap_errno($this->connection).
") ".$this->error;
642 dol_syslog(get_class($this).
"::update ".$this->error, LOG_ERR);
646 dol_syslog(get_class($this).
"::update done successfully");
659 public function delete(
$dn)
661 dol_syslog(get_class($this).
"::delete Delete LDAP entry dn=".
$dn);
664 if (!$this->connection) {
665 $this->error =
"NotConnected";
669 $this->error =
"NotConnected";
676 $result = @ldap_delete($this->connection,
$dn);
698 if (preg_match(
'/^ldap/', $this->server[0])) {
699 $target =
"-H ".join(
',', $this->server);
701 $target =
"-h ".join(
',', $this->server).
" -p ".$this->serverPort;
703 $content .=
"# ldapadd $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
704 $content .=
"# ldapmodify $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
705 $content .=
"# ldapdelete $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
706 if (in_array(
'localhost', $this->server)) {
707 $content .=
"# If commands fails to connect, try without -h and -p\n";
709 $content .=
"dn: ".$dn.
"\n";
710 foreach ($info as $key => $value) {
711 if (!is_array($value)) {
712 $content .=
"$key: $value\n";
714 foreach ($value as $valuevalue) {
715 $content .=
"$key: $valuevalue\n";
739 $outputfile = $conf->ldap->dir_temp.
'/ldapinput.in';
740 $fp = fopen($outputfile,
"w");
742 fputs($fp, $content);
762 if (preg_match(
'/^ldaps:\/\/([^\/]+)\/?$/', $host, $regs)) {
764 $host =
'ssl://'.$regs[1];
765 } elseif (preg_match(
'/^ldap:\/\/([^\/]+)\/?$/', $host, $regs)) {
774 $errno = $errstr = 0;
783 $op = @fsockopen($host, $port, $errno, $errstr, $timeout);
808 dol_syslog(get_class($this).
"::addAttribute dn=".
$dn.
" info=".join(
',', $info));
811 if (!$this->connection) {
812 $this->error =
"NotConnected";
816 $this->error =
"NotConnected";
822 foreach ($info as $key => $val) {
823 if (!is_array($val)) {
831 $result = @ldap_mod_add($this->connection,
$dn, $info);
834 dol_syslog(get_class($this).
"::add_attribute successfull", LOG_DEBUG);
837 $this->error = @ldap_error($this->connection);
838 dol_syslog(get_class($this).
"::add_attribute failed: ".$this->error, LOG_ERR);
854 dol_syslog(get_class($this).
"::updateAttribute dn=".
$dn.
" info=".join(
',', $info));
857 if (!$this->connection) {
858 $this->error =
"NotConnected";
862 $this->error =
"NotConnected";
868 foreach ($info as $key => $val) {
869 if (!is_array($val)) {
877 $result = @ldap_mod_replace($this->connection,
$dn, $info);
880 dol_syslog(get_class($this).
"::updateAttribute successfull", LOG_DEBUG);
883 $this->error = @ldap_error($this->connection);
884 dol_syslog(get_class($this).
"::updateAttribute failed: ".$this->error, LOG_ERR);
900 dol_syslog(get_class($this).
"::deleteAttribute dn=".
$dn.
" info=".join(
',', $info));
903 if (!$this->connection) {
904 $this->error =
"NotConnected";
908 $this->error =
"NotConnected";
914 foreach ($info as $key => $val) {
915 if (!is_array($val)) {
923 $result = @ldap_mod_del($this->connection,
$dn, $info);
926 dol_syslog(get_class($this).
"::deleteAttribute successfull", LOG_DEBUG);
929 $this->error = @ldap_error($this->connection);
930 dol_syslog(get_class($this).
"::deleteAttribute failed: ".$this->error, LOG_ERR);
945 if (!$this->connection) {
946 $this->error =
"NotConnected";
950 $this->error =
"NotConnected";
954 $search = @ldap_search($this->connection,
$dn, $filter);
957 $entry = @ldap_first_entry($this->connection, $search);
960 $this->ldapErrorCode = -1;
961 $this->ldapErrorText =
"Couldn't find entry";
966 if (!($values = ldap_get_attributes($this->connection, $entry))) {
967 $this->ldapErrorCode = ldap_errno($this->connection);
968 $this->ldapErrorText = ldap_error($this->connection);
985 $attributes = array();
986 $attributes[0] = $attribute;
989 $this->result = @ldap_search($this->connection, $this->people, $filterrecord, $attributes);
995 $entry = ldap_first_entry($this->connection, $this->result);
998 $this->ldapErrorCode = -1;
999 $this->ldapErrorText =
"Couldn't find user";
1004 if (!$values = @ldap_get_values($this->connection, $entry, $attribute)) {
1005 $this->ldapErrorCode = ldap_errno($this->connection);
1006 $this->ldapErrorText = ldap_error($this->connection);
1026 public function getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter = 0, $attributeAsArray = array())
1028 $fulllist = array();
1030 dol_syslog(get_class($this).
"::getRecords search=".$search.
" userDn=".$userDn.
" useridentifier=".$useridentifier.
" attributeArray=array(".join(
',', $attributeArray).
") activefilter=".$activefilter);
1033 if ($this->serverType ==
"activedirectory") {
1034 $this->
bindauth($this->searchUser, $this->searchPassword);
1035 dol_syslog(get_class($this).
"::bindauth serverType=activedirectory searchUser=".$this->searchUser);
1039 if (!empty($activefilter)) {
1040 if (((
string) $activefilter ==
'1' || (
string) $activefilter ==
'user') && $this->filter) {
1041 $filter =
'('.$this->filter.
')';
1042 } elseif (((
string) $activefilter ==
'group') && $this->filtergroup ) {
1043 $filter =
'('.$this->filtergroup.
')';
1044 } elseif (((
string) $activefilter ==
'member') && $this->filter) {
1045 $filter =
'('.$this->filtermember.
')';
1048 $filter =
'('.ldap_escape($useridentifier,
'', LDAP_ESCAPE_FILTER).
'=*)';
1051 $filter =
'('.ldap_escape($useridentifier,
'', LDAP_ESCAPE_FILTER).
'='.ldap_escape($search,
'', LDAP_ESCAPE_FILTER).
')';
1054 if (is_array($attributeArray)) {
1056 $attributeArray = array_values($attributeArray);
1057 dol_syslog(get_class($this).
"::getRecords connection=".$this->connectedServer.
":".$this->serverPort.
" userDn=".$userDn.
" filter=".$filter.
" attributeArray=(".join(
',', $attributeArray).
")");
1059 $this->result = @ldap_search($this->connection, $userDn, $filter, $attributeArray);
1062 dol_syslog(get_class($this).
"::getRecords connection=".$this->connectedServer.
":".$this->serverPort.
" userDn=".$userDn.
" filter=".$filter);
1063 $this->result = @ldap_search($this->connection, $userDn, $filter);
1065 if (!$this->result) {
1066 $this->error =
'LDAP search failed: '.ldap_errno($this->connection).
" ".ldap_error($this->connection);
1070 $info = @ldap_get_entries($this->connection, $this->result);
1076 for ($i = 0; $i < $info[
"count"]; $i++) {
1077 $recordid = $this->
convToOutputCharset($info[$i][strtolower($useridentifier)][0], $this->ldapcharset);
1080 $fulllist[$recordid][$useridentifier] = $recordid;
1083 $num = count($attributeArray);
1084 for ($j = 0; $j < $num; $j++) {
1085 $keyattributelower = strtolower($attributeArray[$j]);
1089 if ($this->serverType ==
"activedirectory" && $keyattributelower ==
"objectsid") {
1091 $fulllist[$recordid][$attributeArray[$j]] = $objectsid;
1093 if (in_array($attributeArray[$j], $attributeAsArray) && is_array($info[$i][$keyattributelower])) {
1094 $valueTab = array();
1095 foreach ($info[$i][$keyattributelower] as $key => $value) {
1098 $fulllist[$recordid][$attributeArray[$j]] = $valueTab;
1100 $fulllist[$recordid][$attributeArray[$j]] = $this->
convToOutputCharset($info[$i][$keyattributelower][0], $this->ldapcharset);
1121 for ($x =
dol_strlen($hex) - 2; $x >= 0; $x = $x - 2) {
1122 $result .= substr($hex, $x, 2);
1137 $criteria =
'('.$this->getUserIdentifier().
'='.$ldapUser.
')';
1138 $justthese = array(
"objectsid");
1141 if ($this->serverType ==
"activedirectory") {
1142 $this->
bindauth($this->searchUser, $this->searchPassword);
1149 $ldapSearchResult = @ldap_search($this->connection, $searchDN, $criteria, $justthese);
1151 if (!$ldapSearchResult) {
1152 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1156 $entry = ldap_first_entry($this->connection, $ldapSearchResult);
1169 $ldapBinary = ldap_get_values_len($this->connection, $entry,
"objectsid");
1173 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1187 $hex_sid = bin2hex($binsid);
1188 $rev = hexdec(substr($hex_sid, 0, 2));
1189 $subcount = hexdec(substr($hex_sid, 2, 2));
1190 $auth = hexdec(substr($hex_sid, 4, 12));
1192 for ($x = 0; $x < $subcount; $x++) {
1212 dol_syslog(get_class($this).
"::search checkDn=".$checkDn.
" filter=".$filter);
1218 if ($this->serverType ==
"activedirectory") {
1219 $this->
bindauth($this->searchUser, $this->searchPassword);
1222 $this->result = @ldap_search($this->connection, $checkDn, $filter);
1224 $result = @ldap_get_entries($this->connection, $this->result);
1226 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1229 ldap_free_result($this->result);
1248 if ($this->serverType ==
"activedirectory") {
1249 $this->
bindauth($this->searchUser, $this->searchPassword);
1257 dol_syslog(get_class($this).
"::fetch search with searchDN=".$searchDN.
" filter=".$filter);
1258 $this->result = @ldap_search($this->connection, $searchDN, $filter);
1259 if ($this->result) {
1260 $result = @ldap_get_entries($this->connection, $this->result);
1264 dol_syslog(
'Ldap::fetch search returns but found no records');
1268 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1269 dol_syslog(get_class($this).
"::fetch search fails");
1283 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1295 if (isset(
$result[0][
"pwdlastset"][0])) {
1298 $this->pwdlastset = -1;
1300 if (!$this->
name && !$this->login) {
1301 $this->pwdlastset = -1;
1306 $domain = str_replace(
'dc=',
'', $this->domain);
1312 $this->ldapUserDN =
$result[0][
'dn'];
1314 ldap_free_result($this->result);
1329 if ($this->serverType ==
"activedirectory") {
1330 return $this->attr_sambalogin;
1332 return $this->attr_login;
1346 "TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216,
1347 "PASSWORD_EXPIRED" => 8388608,
1348 "DONT_REQ_PREAUTH" => 4194304,
1349 "USE_DES_KEY_ONLY" => 2097152,
1350 "NOT_DELEGATED" => 1048576,
1351 "TRUSTED_FOR_DELEGATION" => 524288,
1352 "SMARTCARD_REQUIRED" => 262144,
1353 "MNS_LOGON_ACCOUNT" => 131072,
1354 "DONT_EXPIRE_PASSWORD" => 65536,
1355 "SERVER_TRUST_ACCOUNT" => 8192,
1356 "WORKSTATION_TRUST_ACCOUNT" => 4096,
1357 "INTERDOMAIN_TRUST_ACCOUNT" => 2048,
1358 "NORMAL_ACCOUNT" => 512,
1359 "TEMP_DUPLICATE_ACCOUNT" => 256,
1360 "ENCRYPTED_TEXT_PWD_ALLOWED" => 128,
1361 "PASSWD_CANT_CHANGE" => 64,
1362 "PASSWD_NOTREQD" => 32,
1364 "HOMEDIR_REQUIRED" => 8,
1365 "ACCOUNTDISABLE" => 2,
1372 foreach ($flags as $flag => $val) {
1373 if ($uacf >= $val) {
1375 $retval[$val] = $flag;
1392 805306368 =>
"NORMAL_ACCOUNT",
1393 805306369 =>
"WORKSTATION_TRUST",
1394 805306370 =>
"INTERDOMAIN_TRUST",
1395 268435456 =>
"SECURITY_GLOBAL_GROUP",
1396 268435457 =>
"DISTRIBUTION_GROUP",
1397 536870912 =>
"SECURITY_LOCAL_GROUP",
1398 536870913 =>
"DISTRIBUTION_LOCAL_GROUP"
1402 while (list($sat, $val) = each($stypes)) {
1403 if ($samtype == $sat) {
1408 if (empty($retval)) {
1409 $retval =
"UNKNOWN_TYPE_".$samtype;
1425 $dateLargeInt = $value;
1426 $secsAfterADEpoch = $dateLargeInt / (10000000);
1427 $ADToUnixConvertor = ((1970 - 1601) * 365.242190) * 86400;
1428 $unixTimeStamp = intval($secsAfterADEpoch - $ADToUnixConvertor);
1429 return $unixTimeStamp;
1443 if ($pagecodefrom ==
'ISO-8859-1' && $conf->file->character_set_client ==
'UTF-8') {
1444 $str = utf8_encode($str);
1446 if ($pagecodefrom ==
'UTF-8' && $conf->file->character_set_client ==
'ISO-8859-1') {
1447 $str = utf8_decode($str);
1462 if ($pagecodeto ==
'ISO-8859-1' && $conf->file->character_set_client ==
'UTF-8') {
1463 $str = utf8_decode($str);
1465 if ($pagecodeto ==
'UTF-8' && $conf->file->character_set_client ==
'ISO-8859-1') {
1466 $str = utf8_encode($str);
1482 if (empty($keygroup)) {
1483 $keygroup =
'LDAP_KEY_GROUPS';
1486 $search =
'('.$conf->global->$keygroup.
'=*)';
1491 for ($i = 0; $i < $c; $i++) {
1492 $gids[] =
$result[$i][
'gidnumber'][0];
1496 return $gids[0] + 1;
Class to manage LDAP features.
add($dn, $info, $user)
Add a LDAP entry Ldap object connect and bind must have been done.
connect_bind()
Connect and bind Use this->server, this->serverPort, this->ldapProtocolVersion, this->serverType,...
$ldapErrorCode
Code erreur retourne par le serveur Ldap.
modify($dn, $info, $user)
Modify a LDAP entry Ldap object connect and bind must have been done.
deleteAttribute($dn, $info, $user)
Delete a LDAP attribute in entry Ldap object connect and bind must have been done.
$connection
The internal LDAP connection handle.
setVersion()
Change ldap protocol version to use.
convToOutputCharset($str, $pagecodefrom='UTF-8')
Convert a string into output/memory charset.
$server
Tableau des serveurs (IP addresses ou nom d'hotes)
littleEndian($hex)
Converts a little-endian hex-number to one, that 'hexdec' can convert Required by Active Directory.
fetch($user, $filter)
Load all attribute of a LDAP user.
getObjectSid($ldapUser)
Recupere le SID de l'utilisateur Required by Active Directory.
updateAttribute($dn, $info, $user)
Update a LDAP attribute in entry Ldap object connect and bind must have been done.
update($dn, $info, $user, $olddn, $newrdn=false, $newparent=false)
Modify a LDAP entry (to use if dn != olddn) Ldap object connect and bind must have been done.
$ldapErrorText
Message texte de l'erreur.
getUserIdentifier()
Returns the correct user identifier to use, based on the ldap server type.
getAttribute($dn, $filter)
Returns an array containing attributes and values for first record.
$searchPassword
Mot de passe de l'administrateur Active Directory ne supporte pas les connexions anonymes.
close()
Simply closes the connection set up earlier.
$ldapProtocolVersion
Version du protocole ldap.
parseSAT($samtype)
SamAccountType value to text.
rename($dn, $newrdn, $newparent, $user, $deleteoldrdn=true)
Rename a LDAP entry Ldap object connect and bind must have been done.
getNextGroupGid($keygroup='LDAP_KEY_GROUPS')
Return available value of group GID.
$serverType
type de serveur, actuellement OpenLdap et Active Directory
binSIDtoText($binsid)
Returns the textual SID Indispensable pour Active Directory.
setReferrals()
changement du referrals.
search($checkDn, $filter)
Fonction de recherche avec filtre this->connection doit etre defini donc la methode bind ou bindauth ...
getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter=0, $attributeAsArray=array())
Returns an array containing a details or list of LDAP record(s).
getVersion()
Verification de la version du serveur ldap.
convert_time($value)
Convertit le temps ActiveDirectory en Unix timestamp.
$searchUser
User administrateur Ldap Active Directory ne supporte pas les connexions anonymes.
const SYNCHRO_NONE
No Ldap synchronization.
$connectedServer
Current connected server.
dump_content($dn, $info)
Build a LDAP message.
getAttributeValues($filterrecord, $attribute)
Returns an array containing values for an attribute and for first record matching filterrecord.
parseUACF($uacf)
UserAccountControl Flgs to more human understandable form...
__construct()
Constructor.
const SYNCHRO_LDAP_TO_DOLIBARR
Ldap to Dolibarr synchronization.
convFromOutputCharset($str, $pagecodeto='UTF-8')
Convert a string from output/memory charset.
$people
DN des utilisateurs.
serverPing($host, $port=389, $timeout=1)
Ping a server before ldap_connect for avoid waiting.
bind()
Anonymously binds to the connection.
unbind()
Unbind of LDAP server (close connection).
bindauth($bindDn, $pass)
Binds as an authenticated user, which usually allows for write access.
$result
Result of any connections etc.
dump($dn, $info)
Dump a LDAP message to ldapinput.in file.
addAttribute($dn, $info, $user)
Add a LDAP attribute in entry Ldap object connect and bind must have been done.
const SYNCHRO_DOLIBARR_TO_LDAP
Dolibarr to Ldap synchronization.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
$conf db name
Only used if Module[ID]Name translation string is not found.