44 public $errors = array();
123 public $filtermember;
133 public $attr_sambalogin;
143 public $attr_firstname;
187 public $ldapcharset =
'UTF-8';
224 $this->server[] = $conf->global->LDAP_SERVER_HOST;
227 $this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE;
269 global $dolibarr_main_auth_ldap_debug;
274 $this->connectedServer =
'';
276 $ldapdebug = ((empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug ==
"false") ?
false :
true);
279 dol_syslog(get_class($this).
"::connect_bind");
280 print
"DEBUG: connect_bind<br>\n";
284 if (count($this->server) == 0 || empty($this->server[0])) {
285 $this->error =
'LDAP setup (file conf.php) is not complete';
286 dol_syslog(get_class($this).
"::connect_bind ".$this->error, LOG_WARNING);
290 if (!function_exists(
"ldap_connect")) {
291 $this->error =
'LDAPFunctionsNotAvailableOnPHP';
292 dol_syslog(get_class($this).
"::connect_bind ".$this->error, LOG_WARNING);
296 if (empty($this->error)) {
298 foreach ($this->server as $host) {
306 if ($this->
serverPing($host, $this->serverPort) ===
true) {
308 dol_syslog(get_class($this).
"::connect_bind serverPing true, we try ldap_connect to ".$host);
310 if (version_compare(PHP_VERSION,
'8.3.0',
'>=')) {
311 $uri = $host.
':'.$this->serverPort;
312 $this->connection = ldap_connect($uri);
314 $this->connection = ldap_connect($host, $this->serverPort);
317 if (preg_match(
'/^ldaps/i', $host)) {
321 dol_syslog(get_class($this).
"::connect_bind serverPing false, we try ldap_connect to ".$host);
323 if (version_compare(PHP_VERSION,
'8.3.0',
'>=')) {
324 $uri = $host.
':'.$this->serverPort;
325 $this->connection = ldap_connect($uri);
327 $this->connection = ldap_connect($host, $this->serverPort);
334 if (is_resource($this->connection) || is_object($this->connection)) {
336 dol_syslog(get_class($this).
"::connect_bind this->connection is ok", LOG_DEBUG);
346 $resulttls = ldap_start_tls($this->connection);
348 dol_syslog(get_class($this).
"::connect_bind failed to start tls", LOG_WARNING);
349 $this->error =
'ldap_start_tls Failed to start TLS '.ldap_errno($this->connection).
' '.ldap_error($this->connection);
357 ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0);
360 if ($this->serverType ==
"activedirectory") {
362 dol_syslog(get_class($this).
"::connect_bind try bindauth for activedirectory on ".$host.
" user=".$this->searchUser.
" password=".preg_replace(
'/./',
'*', $this->searchPassword), LOG_DEBUG);
363 $this->result = $this->
bindauth($this->searchUser, $this->searchPassword);
367 $this->connectedServer = $host;
370 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
374 if ($this->searchUser && $this->searchPassword) {
375 dol_syslog(get_class($this).
"::connect_bind try bindauth on ".$host.
" user=".$this->searchUser.
" password=".preg_replace(
'/./',
'*', $this->searchPassword), LOG_DEBUG);
376 $this->result = $this->
bindauth($this->searchUser, $this->searchPassword);
380 $this->connectedServer = $host;
383 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
388 dol_syslog(get_class($this).
"::connect_bind try bind anonymously on ".$host, LOG_DEBUG);
393 $this->connectedServer = $host;
396 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
409 $return = $connected;
410 dol_syslog(get_class($this).
"::connect_bind return=".$return, LOG_DEBUG);
412 $this->error =
'Failed to connect to LDAP'.($this->error ?
': '.$this->error :
'');
414 dol_syslog(get_class($this).
"::connect_bind return=".$return.
' - '.$this->error, LOG_WARNING);
441 if (!$this->result = @ldap_bind($this->connection)) {
442 $this->ldapErrorCode = ldap_errno($this->connection);
443 $this->ldapErrorText = ldap_error($this->connection);
463 if (!$this->result = @ldap_bind($this->connection, $bindDn, $pass)) {
464 $this->ldapErrorCode = ldap_errno($this->connection);
465 $this->ldapErrorText = ldap_error($this->connection);
481 $this->result =
true;
482 if (version_compare(PHP_VERSION,
'8.1.0',
'>=')) {
483 if (is_object($this->connection)) {
485 $this->result = ldap_unbind($this->connection);
486 }
catch (Throwable $exception) {
487 $this->error =
'Failed to unbind LDAP connection: '.$exception;
488 $this->result =
false;
489 dol_syslog(get_class($this).
'::unbind - '.$this->error, LOG_WARNING);
493 if (is_resource($this->connection)) {
494 $this->result = @ldap_unbind($this->connection);
513 $version = @ldap_get_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $version);
525 $ldapsetversion = ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldapProtocolVersion);
526 return $ldapsetversion;
537 $ldapreferrals = ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0);
538 return $ldapreferrals;
553 dol_syslog(get_class($this).
"::add dn=".
$dn.
" info=".print_r($info,
true));
556 if (!$this->connection) {
557 $this->error =
"NotConnected";
561 $this->error =
"NotConnected";
567 foreach ($info as $key => $val) {
568 if (!is_array($val)) {
576 $result = @ldap_add($this->connection,
$dn, $info);
579 dol_syslog(get_class($this).
"::add successfull", LOG_DEBUG);
582 $this->ldapErrorCode = @ldap_errno($this->connection);
583 $this->ldapErrorText = @ldap_error($this->connection);
585 dol_syslog(get_class($this).
"::add failed: ".$this->error, LOG_ERR);
601 dol_syslog(get_class($this).
"::modify dn=".
$dn.
" info=".print_r($info,
true));
604 if (!$this->connection) {
605 $this->error =
"NotConnected";
609 $this->error =
"NotConnected";
615 foreach ($info as $key => $val) {
616 if (!is_array($val)) {
626 if ($this->serverType ==
"activedirectory") {
630 if (isset($info[
'unicodePwd'])) {
631 $info[
'unicodePwd'] = mb_convert_encoding(
"\"".$info[
'unicodePwd'].
"\"",
"UTF-16LE",
"UTF-8");
634 $result = @ldap_modify($this->connection,
$dn, $info);
637 dol_syslog(get_class($this).
"::modify successfull", LOG_DEBUG);
640 $this->error = @ldap_error($this->connection);
641 dol_syslog(get_class($this).
"::modify failed: ".$this->error, LOG_ERR);
657 public function rename(
$dn, $newrdn, $newparent, $user, $deleteoldrdn =
true)
659 dol_syslog(get_class($this).
"::modify dn=".
$dn.
" newrdn=".$newrdn.
" newparent=".$newparent.
" deleteoldrdn=".($deleteoldrdn ? 1 : 0));
662 if (!$this->connection) {
663 $this->error =
"NotConnected";
667 $this->error =
"NotConnected";
677 $result = @ldap_rename($this->connection,
$dn, $newrdn, $newparent, $deleteoldrdn);
680 dol_syslog(get_class($this).
"::rename successfull", LOG_DEBUG);
683 $this->error = @ldap_error($this->connection);
684 dol_syslog(get_class($this).
"::rename failed: ".$this->error, LOG_ERR);
701 public function update(
$dn, $info, $user, $olddn, $newrdn =
false, $newparent =
false)
703 dol_syslog(get_class($this).
"::update dn=".
$dn.
" olddn=".$olddn);
706 if (!$this->connection) {
707 $this->error =
"NotConnected";
711 $this->error =
"NotConnected";
715 if (!$olddn || $olddn !=
$dn) {
716 if (!empty($olddn) && !empty($newrdn) && !empty($newparent) && $this->ldapProtocolVersion ===
'3') {
718 $result = $this->
rename($olddn, $newrdn, $newparent, $user,
true);
724 $result = $this->
delete($olddn);
733 $this->error = ldap_error($this->connection).
' (Code '.ldap_errno($this->connection).
") ".$this->error;
734 dol_syslog(get_class($this).
"::update ".$this->error, LOG_ERR);
738 dol_syslog(get_class($this).
"::update done successfully");
751 public function delete(
$dn)
753 dol_syslog(get_class($this).
"::delete Delete LDAP entry dn=".
$dn);
756 if (!$this->connection) {
757 $this->error =
"NotConnected";
761 $this->error =
"NotConnected";
768 $result = @ldap_delete($this->connection,
$dn);
790 if (preg_match(
'/^ldap/', $this->server[0])) {
791 $target =
"-H ".join(
',', $this->server);
793 $target =
"-h ".join(
',', $this->server).
" -p ".$this->serverPort;
795 $content .=
"# ldapadd $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
796 $content .=
"# ldapmodify $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
797 $content .=
"# ldapdelete $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
798 if (in_array(
'localhost', $this->server)) {
799 $content .=
"# If commands fails to connect, try without -h and -p\n";
801 $content .=
"dn: ".$dn.
"\n";
802 foreach ($info as $key => $value) {
803 if (!is_array($value)) {
804 $content .=
"$key: $value\n";
806 foreach ($value as $valuevalue) {
807 $content .=
"$key: $valuevalue\n";
831 $outputfile = $conf->ldap->dir_temp.
'/ldapinput.in';
832 $fp = fopen($outputfile,
"w");
834 fputs($fp, $content);
854 if (preg_match(
'/^ldaps:\/\/([^\/]+)\/?$/', $host, $regs)) {
856 $host =
'ssl://'.$regs[1];
857 } elseif (preg_match(
'/^ldap:\/\/([^\/]+)\/?$/', $host, $regs)) {
866 $errno = $errstr = 0;
875 $op = @fsockopen($host, $port, $errno, $errstr, $timeout);
900 dol_syslog(get_class($this).
"::addAttribute 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_add($this->connection,
$dn, $info);
926 dol_syslog(get_class($this).
"::add_attribute successfull", LOG_DEBUG);
929 $this->error = @ldap_error($this->connection);
930 dol_syslog(get_class($this).
"::add_attribute failed: ".$this->error, LOG_ERR);
946 dol_syslog(get_class($this).
"::updateAttribute dn=".
$dn.
" info=".join(
',', $info));
949 if (!$this->connection) {
950 $this->error =
"NotConnected";
954 $this->error =
"NotConnected";
960 foreach ($info as $key => $val) {
961 if (!is_array($val)) {
969 $result = @ldap_mod_replace($this->connection,
$dn, $info);
972 dol_syslog(get_class($this).
"::updateAttribute successfull", LOG_DEBUG);
975 $this->error = @ldap_error($this->connection);
976 dol_syslog(get_class($this).
"::updateAttribute failed: ".$this->error, LOG_ERR);
992 dol_syslog(get_class($this).
"::deleteAttribute dn=".
$dn.
" info=".join(
',', $info));
995 if (!$this->connection) {
996 $this->error =
"NotConnected";
1000 $this->error =
"NotConnected";
1006 foreach ($info as $key => $val) {
1007 if (!is_array($val)) {
1015 $result = @ldap_mod_del($this->connection,
$dn, $info);
1018 dol_syslog(get_class($this).
"::deleteAttribute successfull", LOG_DEBUG);
1021 $this->error = @ldap_error($this->connection);
1022 dol_syslog(get_class($this).
"::deleteAttribute failed: ".$this->error, LOG_ERR);
1037 if (!$this->connection) {
1038 $this->error =
"NotConnected";
1042 $this->error =
"NotConnected";
1046 $search = @ldap_search($this->connection,
$dn, $filter);
1049 $entry = @ldap_first_entry($this->connection, $search);
1052 $this->ldapErrorCode = -1;
1053 $this->ldapErrorText =
"Couldn't find entry";
1058 if (!($values = ldap_get_attributes($this->connection, $entry))) {
1059 $this->ldapErrorCode = ldap_errno($this->connection);
1060 $this->ldapErrorText = ldap_error($this->connection);
1077 $attributes = array();
1078 $attributes[0] = $attribute;
1081 $this->result = @ldap_search($this->connection, $this->people, $filterrecord, $attributes);
1087 $entry = ldap_first_entry($this->connection, $this->result);
1090 $this->ldapErrorCode = -1;
1091 $this->ldapErrorText =
"Couldn't find user";
1096 if (!$values = @ldap_get_values($this->connection, $entry, $attribute)) {
1097 $this->ldapErrorCode = ldap_errno($this->connection);
1098 $this->ldapErrorText = ldap_error($this->connection);
1118 public function getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter = 0, $attributeAsArray = array())
1120 $fulllist = array();
1122 dol_syslog(get_class($this).
"::getRecords search=".$search.
" userDn=".$userDn.
" useridentifier=".$useridentifier.
" attributeArray=array(".join(
',', $attributeArray).
") activefilter=".$activefilter);
1125 if ($this->serverType ==
"activedirectory") {
1126 $this->
bindauth($this->searchUser, $this->searchPassword);
1127 dol_syslog(get_class($this).
"::bindauth serverType=activedirectory searchUser=".$this->searchUser);
1131 if (!empty($activefilter)) {
1132 if (((
string) $activefilter ==
'1' || (
string) $activefilter ==
'user') && $this->filter) {
1133 $filter =
'('.$this->filter.
')';
1134 } elseif (((
string) $activefilter ==
'group') && $this->filtergroup) {
1135 $filter =
'('.$this->filtergroup.
')';
1136 } elseif (((
string) $activefilter ==
'member') && $this->filter) {
1137 $filter =
'('.$this->filtermember.
')';
1140 $filter =
'('.ldap_escape($useridentifier,
'', LDAP_ESCAPE_FILTER).
'=*)';
1143 $filter =
'('.ldap_escape($useridentifier,
'', LDAP_ESCAPE_FILTER).
'='.ldap_escape($search,
'', LDAP_ESCAPE_FILTER).
')';
1146 if (is_array($attributeArray)) {
1148 $attributeArray = array_values($attributeArray);
1149 dol_syslog(get_class($this).
"::getRecords connection=".$this->connectedServer.
":".$this->serverPort.
" userDn=".$userDn.
" filter=".$filter.
" attributeArray=(".join(
',', $attributeArray).
")");
1151 $this->result = @ldap_search($this->connection, $userDn, $filter, $attributeArray);
1154 dol_syslog(get_class($this).
"::getRecords connection=".$this->connectedServer.
":".$this->serverPort.
" userDn=".$userDn.
" filter=".$filter);
1155 $this->result = @ldap_search($this->connection, $userDn, $filter);
1157 if (!$this->result) {
1158 $this->error =
'LDAP search failed: '.ldap_errno($this->connection).
" ".ldap_error($this->connection);
1162 $info = @ldap_get_entries($this->connection, $this->result);
1168 for ($i = 0; $i < $info[
"count"]; $i++) {
1169 $recordid = $this->
convToOutputCharset($info[$i][strtolower($useridentifier)][0], $this->ldapcharset);
1172 $fulllist[$recordid][$useridentifier] = $recordid;
1175 $num = count($attributeArray);
1176 for ($j = 0; $j < $num; $j++) {
1177 $keyattributelower = strtolower($attributeArray[$j]);
1181 if ($this->serverType ==
"activedirectory" && $keyattributelower ==
"objectsid") {
1183 $fulllist[$recordid][$attributeArray[$j]] = $objectsid;
1185 if (in_array($attributeArray[$j], $attributeAsArray) && is_array($info[$i][$keyattributelower])) {
1186 $valueTab = array();
1187 foreach ($info[$i][$keyattributelower] as $key => $value) {
1190 $fulllist[$recordid][$attributeArray[$j]] = $valueTab;
1192 $fulllist[$recordid][$attributeArray[$j]] = $this->
convToOutputCharset($info[$i][$keyattributelower][0], $this->ldapcharset);
1213 for ($x =
dol_strlen($hex) - 2; $x >= 0; $x = $x - 2) {
1214 $result .= substr($hex, $x, 2);
1229 $criteria =
'('.$this->getUserIdentifier().
'='.$ldapUser.
')';
1230 $justthese = array(
"objectsid");
1233 if ($this->serverType ==
"activedirectory") {
1234 $this->
bindauth($this->searchUser, $this->searchPassword);
1241 $ldapSearchResult = @ldap_search($this->connection, $searchDN, $criteria, $justthese);
1243 if (!$ldapSearchResult) {
1244 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1248 $entry = ldap_first_entry($this->connection, $ldapSearchResult);
1261 $ldapBinary = ldap_get_values_len($this->connection, $entry,
"objectsid");
1265 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1279 $hex_sid = bin2hex($binsid);
1280 $rev = hexdec(substr($hex_sid, 0, 2));
1281 $subcount = hexdec(substr($hex_sid, 2, 2));
1282 $auth = hexdec(substr($hex_sid, 4, 12));
1284 for ($x = 0; $x < $subcount; $x++) {
1304 dol_syslog(get_class($this).
"::search checkDn=".$checkDn.
" filter=".$filter);
1310 if ($this->serverType ==
"activedirectory") {
1311 $this->
bindauth($this->searchUser, $this->searchPassword);
1314 $this->result = @ldap_search($this->connection, $checkDn, $filter);
1316 $result = @ldap_get_entries($this->connection, $this->result);
1318 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1321 ldap_free_result($this->result);
1340 if ($this->serverType ==
"activedirectory") {
1341 $this->
bindauth($this->searchUser, $this->searchPassword);
1349 dol_syslog(get_class($this).
"::fetch search with searchDN=".$searchDN.
" filter=".$filter);
1350 $this->result = @ldap_search($this->connection, $searchDN, $filter);
1351 if ($this->result) {
1352 $result = @ldap_get_entries($this->connection, $this->result);
1356 dol_syslog(
'Ldap::fetch search returns but found no records');
1360 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1361 dol_syslog(get_class($this).
"::fetch search fails");
1375 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1387 if (isset(
$result[0][
"pwdlastset"][0])) {
1390 $this->pwdlastset = -1;
1392 if (!$this->
name && !$this->login) {
1393 $this->pwdlastset = -1;
1398 $domain = str_replace(
'dc=',
'', $this->domain);
1404 $this->ldapUserDN =
$result[0][
'dn'];
1406 ldap_free_result($this->result);
1421 if ($this->serverType ==
"activedirectory") {
1422 return $this->attr_sambalogin;
1424 return $this->attr_login;
1438 "TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216,
1439 "PASSWORD_EXPIRED" => 8388608,
1440 "DONT_REQ_PREAUTH" => 4194304,
1441 "USE_DES_KEY_ONLY" => 2097152,
1442 "NOT_DELEGATED" => 1048576,
1443 "TRUSTED_FOR_DELEGATION" => 524288,
1444 "SMARTCARD_REQUIRED" => 262144,
1445 "MNS_LOGON_ACCOUNT" => 131072,
1446 "DONT_EXPIRE_PASSWORD" => 65536,
1447 "SERVER_TRUST_ACCOUNT" => 8192,
1448 "WORKSTATION_TRUST_ACCOUNT" => 4096,
1449 "INTERDOMAIN_TRUST_ACCOUNT" => 2048,
1450 "NORMAL_ACCOUNT" => 512,
1451 "TEMP_DUPLICATE_ACCOUNT" => 256,
1452 "ENCRYPTED_TEXT_PWD_ALLOWED" => 128,
1453 "PASSWD_CANT_CHANGE" => 64,
1454 "PASSWD_NOTREQD" => 32,
1456 "HOMEDIR_REQUIRED" => 8,
1457 "ACCOUNTDISABLE" => 2,
1464 foreach ($flags as $flag => $val) {
1465 if ($uacf >= $val) {
1467 $retval[$val] = $flag;
1484 805306368 =>
"NORMAL_ACCOUNT",
1485 805306369 =>
"WORKSTATION_TRUST",
1486 805306370 =>
"INTERDOMAIN_TRUST",
1487 268435456 =>
"SECURITY_GLOBAL_GROUP",
1488 268435457 =>
"DISTRIBUTION_GROUP",
1489 536870912 =>
"SECURITY_LOCAL_GROUP",
1490 536870913 =>
"DISTRIBUTION_LOCAL_GROUP"
1494 foreach ($stypes as $sat => $val) {
1495 if ($samtype == $sat) {
1500 if (empty($retval)) {
1501 $retval =
"UNKNOWN_TYPE_".$samtype;
1517 $dateLargeInt = $value;
1518 $secsAfterADEpoch = $dateLargeInt / (10000000);
1519 $ADToUnixConvertor = ((1970 - 1601) * 365.242190) * 86400;
1520 $unixTimeStamp = intval($secsAfterADEpoch - $ADToUnixConvertor);
1521 return $unixTimeStamp;
1535 if ($pagecodefrom ==
'ISO-8859-1' && $conf->file->character_set_client ==
'UTF-8') {
1536 $str = mb_convert_encoding($str,
'UTF-8',
'ISO-8859-1');
1538 if ($pagecodefrom ==
'UTF-8' && $conf->file->character_set_client ==
'ISO-8859-1') {
1539 $str = mb_convert_encoding($str,
'ISO-8859-1');
1554 if ($pagecodeto ==
'ISO-8859-1' && $conf->file->character_set_client ==
'UTF-8') {
1555 $str = mb_convert_encoding($str,
'ISO-8859-1');
1557 if ($pagecodeto ==
'UTF-8' && $conf->file->character_set_client ==
'ISO-8859-1') {
1558 $str = mb_convert_encoding($str,
'UTF-8',
'ISO-8859-1');
1574 if (empty($keygroup)) {
1575 $keygroup =
'LDAP_KEY_GROUPS';
1583 for ($i = 0; $i < $c; $i++) {
1584 $gids[] =
$result[$i][
'gidnumber'][0];
1588 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 a 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.