44 public $errors = array();
113 public $ldapcharset =
'UTF-8';
149 if (!empty($conf->global->LDAP_SERVER_HOST)) {
150 $this->server[] = $conf->global->LDAP_SERVER_HOST;
152 if (!empty($conf->global->LDAP_SERVER_HOST_SLAVE)) {
153 $this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE;
196 global $dolibarr_main_auth_ldap_debug;
201 $this->connectedServer =
'';
203 $ldapdebug = ((empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug ==
"false") ?
false :
true);
206 dol_syslog(get_class($this).
"::connect_bind");
207 print
"DEBUG: connect_bind<br>\n";
211 if (count($this->server) == 0 || empty($this->server[0])) {
212 $this->error =
'LDAP setup (file conf.php) is not complete';
213 dol_syslog(get_class($this).
"::connect_bind ".$this->error, LOG_WARNING);
217 if (!function_exists(
"ldap_connect")) {
218 $this->error =
'LDAPFunctionsNotAvailableOnPHP';
219 dol_syslog(get_class($this).
"::connect_bind ".$this->error, LOG_WARNING);
223 if (empty($this->error)) {
225 foreach ($this->server as $host) {
233 if ($this->
serverPing($host, $this->serverPort) ===
true) {
235 dol_syslog(get_class($this).
"::connect_bind serverPing true, we try ldap_connect to ".$host);
237 $this->connection = ldap_connect($host, $this->serverPort);
239 if (preg_match(
'/^ldaps/i', $host)) {
243 dol_syslog(get_class($this).
"::connect_bind serverPing false, we try ldap_connect to ".$host);
245 $this->connection = ldap_connect($host, $this->serverPort);
251 if (is_resource($this->connection) || is_object($this->connection)) {
253 dol_syslog(get_class($this).
"::connect_bind this->connection is ok", LOG_DEBUG);
257 if (!empty($conf->global->LDAP_SERVER_USE_TLS)) {
263 $resulttls = ldap_start_tls($this->connection);
265 dol_syslog(get_class($this).
"::connect_bind failed to start tls", LOG_WARNING);
266 $this->error =
'ldap_start_tls Failed to start TLS '.ldap_errno($this->connection).
' '.ldap_error($this->connection);
274 ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0);
277 if ($this->serverType ==
"activedirectory") {
279 dol_syslog(get_class($this).
"::connect_bind try bindauth for activedirectory on ".$host.
" user=".$this->searchUser.
" password=".preg_replace(
'/./',
'*', $this->searchPassword), LOG_DEBUG);
280 $this->result = $this->
bindauth($this->searchUser, $this->searchPassword);
284 $this->connectedServer = $host;
287 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
291 if ($this->searchUser && $this->searchPassword) {
292 dol_syslog(get_class($this).
"::connect_bind try bindauth on ".$host.
" user=".$this->searchUser.
" password=".preg_replace(
'/./',
'*', $this->searchPassword), LOG_DEBUG);
293 $this->result = $this->
bindauth($this->searchUser, $this->searchPassword);
297 $this->connectedServer = $host;
300 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
305 dol_syslog(get_class($this).
"::connect_bind try bind anonymously on ".$host, LOG_DEBUG);
310 $this->connectedServer = $host;
313 $this->error = ldap_errno($this->connection).
' '.ldap_error($this->connection);
326 $return = $connected;
327 dol_syslog(get_class($this).
"::connect_bind return=".$return, LOG_DEBUG);
329 $this->error =
'Failed to connect to LDAP'.($this->error ?
': '.$this->error :
'');
331 dol_syslog(get_class($this).
"::connect_bind return=".$return.
' - '.$this->error, LOG_WARNING);
347 $r_type = get_resource_type($this->connection);
348 if ($this->connection && ($r_type ===
"Unknown" || !@ldap_close($this->connection))) {
363 if (!$this->result = @ldap_bind($this->connection)) {
364 $this->ldapErrorCode = ldap_errno($this->connection);
365 $this->ldapErrorText = ldap_error($this->connection);
385 if (!$this->result = @ldap_bind($this->connection, $bindDn, $pass)) {
386 $this->ldapErrorCode = ldap_errno($this->connection);
387 $this->ldapErrorText = ldap_error($this->connection);
403 $this->result =
true;
404 if ($this->connection) {
405 $this->result = @ldap_unbind($this->connection);
423 $version = @ldap_get_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $version);
435 $ldapsetversion = ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldapProtocolVersion);
436 return $ldapsetversion;
447 $ldapreferrals = ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0);
448 return $ldapreferrals;
463 dol_syslog(get_class($this).
"::add dn=".
$dn.
" info=".json_encode($info));
466 if (!$this->connection) {
467 $this->error =
"NotConnected";
471 $this->error =
"NotConnected";
477 foreach ($info as $key => $val) {
478 if (!is_array($val)) {
486 $result = @ldap_add($this->connection,
$dn, $info);
489 dol_syslog(get_class($this).
"::add successfull", LOG_DEBUG);
492 $this->ldapErrorCode = @ldap_errno($this->connection);
493 $this->ldapErrorText = @ldap_error($this->connection);
495 dol_syslog(get_class($this).
"::add failed: ".$this->error, LOG_ERR);
511 dol_syslog(get_class($this).
"::modify dn=".
$dn.
" info=".join(
',', $info));
514 if (!$this->connection) {
515 $this->error =
"NotConnected";
519 $this->error =
"NotConnected";
525 foreach ($info as $key => $val) {
526 if (!is_array($val)) {
536 if ($this->serverType ==
"activedirectory") {
540 if (isset($info[
'unicodePwd'])) {
541 $info[
'unicodePwd'] = mb_convert_encoding(
"\"".$info[
'unicodePwd'].
"\"",
"UTF-16LE",
"UTF-8");
544 $result = @ldap_modify($this->connection,
$dn, $info);
547 dol_syslog(get_class($this).
"::modify successfull", LOG_DEBUG);
550 $this->error = @ldap_error($this->connection);
551 dol_syslog(get_class($this).
"::modify failed: ".$this->error, LOG_ERR);
567 public function rename(
$dn, $newrdn, $newparent, $user, $deleteoldrdn =
true)
569 dol_syslog(get_class($this).
"::modify dn=".
$dn.
" newrdn=".$newrdn.
" newparent=".$newparent.
" deleteoldrdn=".($deleteoldrdn ? 1 : 0));
572 if (!$this->connection) {
573 $this->error =
"NotConnected";
577 $this->error =
"NotConnected";
587 $result = @ldap_rename($this->connection,
$dn, $newrdn, $newparent, $deleteoldrdn);
590 dol_syslog(get_class($this).
"::rename successfull", LOG_DEBUG);
593 $this->error = @ldap_error($this->connection);
594 dol_syslog(get_class($this).
"::rename failed: ".$this->error, LOG_ERR);
611 public function update(
$dn, $info, $user, $olddn, $newrdn =
false, $newparent =
false)
613 dol_syslog(get_class($this).
"::update dn=".
$dn.
" olddn=".$olddn);
616 if (!$this->connection) {
617 $this->error =
"NotConnected";
621 $this->error =
"NotConnected";
625 if (!$olddn || $olddn !=
$dn) {
626 if (!empty($olddn) && !empty($newrdn) && !empty($newparent) && $this->ldapProtocolVersion ===
'3') {
628 $result = $this->
rename($olddn, $newrdn, $newparent, $user,
true);
634 $result = $this->
delete($olddn);
643 $this->error = ldap_error($this->connection).
' (Code '.ldap_errno($this->connection).
") ".$this->error;
644 dol_syslog(get_class($this).
"::update ".$this->error, LOG_ERR);
648 dol_syslog(get_class($this).
"::update done successfully");
661 public function delete(
$dn)
663 dol_syslog(get_class($this).
"::delete Delete LDAP entry dn=".
$dn);
666 if (!$this->connection) {
667 $this->error =
"NotConnected";
671 $this->error =
"NotConnected";
678 $result = @ldap_delete($this->connection,
$dn);
700 if (preg_match(
'/^ldap/', $this->server[0])) {
701 $target =
"-H ".join(
',', $this->server);
703 $target =
"-h ".join(
',', $this->server).
" -p ".$this->serverPort;
705 $content .=
"# ldapadd $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
706 $content .=
"# ldapmodify $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
707 $content .=
"# ldapdelete $target -c -v -D ".$this->searchUser.
" -W -f ldapinput.in\n";
708 if (in_array(
'localhost', $this->server)) {
709 $content .=
"# If commands fails to connect, try without -h and -p\n";
711 $content .=
"dn: ".$dn.
"\n";
712 foreach ($info as $key => $value) {
713 if (!is_array($value)) {
714 $content .=
"$key: $value\n";
716 foreach ($value as $valuevalue) {
717 $content .=
"$key: $valuevalue\n";
741 $outputfile = $conf->ldap->dir_temp.
'/ldapinput.in';
742 $fp = fopen($outputfile,
"w");
744 fputs($fp, $content);
746 if (!empty($conf->global->MAIN_UMASK)) {
747 @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
766 if (preg_match(
'/^ldaps:\/\/([^\/]+)\/?$/', $host, $regs)) {
768 $host =
'ssl://'.$regs[1];
769 } elseif (preg_match(
'/^ldap:\/\/([^\/]+)\/?$/', $host, $regs)) {
778 $errno = $errstr = 0;
787 $op = @fsockopen($host, $port, $errno, $errstr, $timeout);
812 dol_syslog(get_class($this).
"::addAttribute dn=".
$dn.
" info=".join(
',', $info));
815 if (!$this->connection) {
816 $this->error =
"NotConnected";
820 $this->error =
"NotConnected";
826 foreach ($info as $key => $val) {
827 if (!is_array($val)) {
835 $result = @ldap_mod_add($this->connection,
$dn, $info);
838 dol_syslog(get_class($this).
"::add_attribute successfull", LOG_DEBUG);
841 $this->error = @ldap_error($this->connection);
842 dol_syslog(get_class($this).
"::add_attribute failed: ".$this->error, LOG_ERR);
858 dol_syslog(get_class($this).
"::updateAttribute dn=".
$dn.
" info=".join(
',', $info));
861 if (!$this->connection) {
862 $this->error =
"NotConnected";
866 $this->error =
"NotConnected";
872 foreach ($info as $key => $val) {
873 if (!is_array($val)) {
881 $result = @ldap_mod_replace($this->connection,
$dn, $info);
884 dol_syslog(get_class($this).
"::updateAttribute successfull", LOG_DEBUG);
887 $this->error = @ldap_error($this->connection);
888 dol_syslog(get_class($this).
"::updateAttribute failed: ".$this->error, LOG_ERR);
904 dol_syslog(get_class($this).
"::deleteAttribute dn=".
$dn.
" info=".join(
',', $info));
907 if (!$this->connection) {
908 $this->error =
"NotConnected";
912 $this->error =
"NotConnected";
918 foreach ($info as $key => $val) {
919 if (!is_array($val)) {
927 $result = @ldap_mod_del($this->connection,
$dn, $info);
930 dol_syslog(get_class($this).
"::deleteAttribute successfull", LOG_DEBUG);
933 $this->error = @ldap_error($this->connection);
934 dol_syslog(get_class($this).
"::deleteAttribute failed: ".$this->error, LOG_ERR);
949 if (!$this->connection) {
950 $this->error =
"NotConnected";
954 $this->error =
"NotConnected";
958 $search = @ldap_search($this->connection,
$dn, $filter);
961 $entry = @ldap_first_entry($this->connection, $search);
964 $this->ldapErrorCode = -1;
965 $this->ldapErrorText =
"Couldn't find entry";
970 if (!($values = ldap_get_attributes($this->connection, $entry))) {
971 $this->ldapErrorCode = ldap_errno($this->connection);
972 $this->ldapErrorText = ldap_error($this->connection);
989 $attributes = array();
990 $attributes[0] = $attribute;
993 $this->result = @ldap_search($this->connection, $this->people, $filterrecord, $attributes);
999 $entry = ldap_first_entry($this->connection, $this->result);
1002 $this->ldapErrorCode = -1;
1003 $this->ldapErrorText =
"Couldn't find user";
1008 if (!$values = @ldap_get_values($this->connection, $entry, $attribute)) {
1009 $this->ldapErrorCode = ldap_errno($this->connection);
1010 $this->ldapErrorText = ldap_error($this->connection);
1030 public function getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter = 0, $attributeAsArray = array())
1032 $fulllist = array();
1034 dol_syslog(get_class($this).
"::getRecords search=".$search.
" userDn=".$userDn.
" useridentifier=".$useridentifier.
" attributeArray=array(".join(
',', $attributeArray).
") activefilter=".$activefilter);
1037 if ($this->serverType ==
"activedirectory") {
1038 $this->
bindauth($this->searchUser, $this->searchPassword);
1039 dol_syslog(get_class($this).
"::bindauth serverType=activedirectory searchUser=".$this->searchUser);
1043 if (!empty($activefilter)) {
1044 if (((
string) $activefilter ==
'1' || (
string) $activefilter ==
'user') && $this->filter) {
1045 $filter =
'('.$this->filter.
')';
1046 } elseif (((
string) $activefilter ==
'group') && $this->filtergroup ) {
1047 $filter =
'('.$this->filtergroup.
')';
1048 } elseif (((
string) $activefilter ==
'member') && $this->filter) {
1049 $filter =
'('.$this->filtermember.
')';
1052 $filter =
'('.ldap_escape($useridentifier,
'', LDAP_ESCAPE_FILTER).
'=*)';
1055 $filter =
'('.ldap_escape($useridentifier,
'', LDAP_ESCAPE_FILTER).
'='.ldap_escape($search,
'', LDAP_ESCAPE_FILTER).
')';
1058 if (is_array($attributeArray)) {
1060 $attributeArray = array_values($attributeArray);
1061 dol_syslog(get_class($this).
"::getRecords connection=".$this->connectedServer.
":".$this->serverPort.
" userDn=".$userDn.
" filter=".$filter.
" attributeArray=(".join(
',', $attributeArray).
")");
1063 $this->result = @ldap_search($this->connection, $userDn, $filter, $attributeArray);
1066 dol_syslog(get_class($this).
"::getRecords connection=".$this->connectedServer.
":".$this->serverPort.
" userDn=".$userDn.
" filter=".$filter);
1067 $this->result = @ldap_search($this->connection, $userDn, $filter);
1069 if (!$this->result) {
1070 $this->error =
'LDAP search failed: '.ldap_errno($this->connection).
" ".ldap_error($this->connection);
1074 $info = @ldap_get_entries($this->connection, $this->result);
1080 for ($i = 0; $i < $info[
"count"]; $i++) {
1081 $recordid = $this->
convToOutputCharset($info[$i][strtolower($useridentifier)][0], $this->ldapcharset);
1084 $fulllist[$recordid][$useridentifier] = $recordid;
1087 $num = count($attributeArray);
1088 for ($j = 0; $j < $num; $j++) {
1089 $keyattributelower = strtolower($attributeArray[$j]);
1093 if ($this->serverType ==
"activedirectory" && $keyattributelower ==
"objectsid") {
1095 $fulllist[$recordid][$attributeArray[$j]] = $objectsid;
1097 if (in_array($attributeArray[$j], $attributeAsArray) && is_array($info[$i][$keyattributelower])) {
1098 $valueTab = array();
1099 foreach ($info[$i][$keyattributelower] as $key => $value) {
1102 $fulllist[$recordid][$attributeArray[$j]] = $valueTab;
1104 $fulllist[$recordid][$attributeArray[$j]] = $this->
convToOutputCharset($info[$i][$keyattributelower][0], $this->ldapcharset);
1125 for ($x =
dol_strlen($hex) - 2; $x >= 0; $x = $x - 2) {
1126 $result .= substr($hex, $x, 2);
1141 $criteria =
'('.$this->getUserIdentifier().
'='.$ldapUser.
')';
1142 $justthese = array(
"objectsid");
1145 if ($this->serverType ==
"activedirectory") {
1146 $this->
bindauth($this->searchUser, $this->searchPassword);
1153 $ldapSearchResult = @ldap_search($this->connection, $searchDN, $criteria, $justthese);
1155 if (!$ldapSearchResult) {
1156 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1160 $entry = ldap_first_entry($this->connection, $ldapSearchResult);
1173 $ldapBinary = ldap_get_values_len($this->connection, $entry,
"objectsid");
1177 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1191 $hex_sid = bin2hex($binsid);
1192 $rev = hexdec(substr($hex_sid, 0, 2));
1193 $subcount = hexdec(substr($hex_sid, 2, 2));
1194 $auth = hexdec(substr($hex_sid, 4, 12));
1196 for ($x = 0; $x < $subcount; $x++) {
1216 dol_syslog(get_class($this).
"::search checkDn=".$checkDn.
" filter=".$filter);
1222 if ($this->serverType ==
"activedirectory") {
1223 $this->
bindauth($this->searchUser, $this->searchPassword);
1226 $this->result = @ldap_search($this->connection, $checkDn, $filter);
1228 $result = @ldap_get_entries($this->connection, $this->result);
1230 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1233 ldap_free_result($this->result);
1252 if ($this->serverType ==
"activedirectory") {
1253 $this->
bindauth($this->searchUser, $this->searchPassword);
1261 dol_syslog(get_class($this).
"::fetch search with searchDN=".$searchDN.
" filter=".$filter);
1262 $this->result = @ldap_search($this->connection, $searchDN, $filter);
1263 if ($this->result) {
1264 $result = @ldap_get_entries($this->connection, $this->result);
1268 dol_syslog(
'Ldap::fetch search returns but found no records');
1272 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1273 dol_syslog(get_class($this).
"::fetch search fails");
1287 $this->error = ldap_errno($this->connection).
" ".ldap_error($this->connection);
1300 if (isset(
$result[0][
"pwdlastset"][0])) {
1303 $this->pwdlastset = -1;
1305 if (!$this->
name && !$this->login) {
1306 $this->pwdlastset = -1;
1311 $domain = str_replace(
'dc=',
'', $this->domain);
1317 $this->ldapUserDN =
$result[0][
'dn'];
1319 ldap_free_result($this->result);
1334 if ($this->serverType ==
"activedirectory") {
1335 return $this->attr_sambalogin;
1337 return $this->attr_login;
1351 "TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216,
1352 "PASSWORD_EXPIRED" => 8388608,
1353 "DONT_REQ_PREAUTH" => 4194304,
1354 "USE_DES_KEY_ONLY" => 2097152,
1355 "NOT_DELEGATED" => 1048576,
1356 "TRUSTED_FOR_DELEGATION" => 524288,
1357 "SMARTCARD_REQUIRED" => 262144,
1358 "MNS_LOGON_ACCOUNT" => 131072,
1359 "DONT_EXPIRE_PASSWORD" => 65536,
1360 "SERVER_TRUST_ACCOUNT" => 8192,
1361 "WORKSTATION_TRUST_ACCOUNT" => 4096,
1362 "INTERDOMAIN_TRUST_ACCOUNT" => 2048,
1363 "NORMAL_ACCOUNT" => 512,
1364 "TEMP_DUPLICATE_ACCOUNT" => 256,
1365 "ENCRYPTED_TEXT_PWD_ALLOWED" => 128,
1366 "PASSWD_CANT_CHANGE" => 64,
1367 "PASSWD_NOTREQD" => 32,
1369 "HOMEDIR_REQUIRED" => 8,
1370 "ACCOUNTDISABLE" => 2,
1377 foreach ($flags as $flag => $val) {
1378 if ($uacf >= $val) {
1380 $retval[$val] = $flag;
1397 805306368 =>
"NORMAL_ACCOUNT",
1398 805306369 =>
"WORKSTATION_TRUST",
1399 805306370 =>
"INTERDOMAIN_TRUST",
1400 268435456 =>
"SECURITY_GLOBAL_GROUP",
1401 268435457 =>
"DISTRIBUTION_GROUP",
1402 536870912 =>
"SECURITY_LOCAL_GROUP",
1403 536870913 =>
"DISTRIBUTION_LOCAL_GROUP"
1407 while (list($sat, $val) = each($stypes)) {
1408 if ($samtype == $sat) {
1413 if (empty($retval)) {
1414 $retval =
"UNKNOWN_TYPE_".$samtype;
1430 $dateLargeInt = $value;
1431 $secsAfterADEpoch = $dateLargeInt / (10000000);
1432 $ADToUnixConvertor = ((1970 - 1601) * 365.242190) * 86400;
1433 $unixTimeStamp = intval($secsAfterADEpoch - $ADToUnixConvertor);
1434 return $unixTimeStamp;
1448 if ($pagecodefrom ==
'ISO-8859-1' && $conf->file->character_set_client ==
'UTF-8') {
1449 $str = utf8_encode($str);
1451 if ($pagecodefrom ==
'UTF-8' && $conf->file->character_set_client ==
'ISO-8859-1') {
1452 $str = utf8_decode($str);
1467 if ($pagecodeto ==
'ISO-8859-1' && $conf->file->character_set_client ==
'UTF-8') {
1468 $str = utf8_decode($str);
1470 if ($pagecodeto ==
'UTF-8' && $conf->file->character_set_client ==
'ISO-8859-1') {
1471 $str = utf8_encode($str);
1487 if (empty($keygroup)) {
1488 $keygroup =
'LDAP_KEY_GROUPS';
1491 $search =
'('.$conf->global->$keygroup.
'=*)';
1496 for ($i = 0; $i < $c; $i++) {
1497 $gids[] =
$result[$i][
'gidnumber'][0];
1501 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.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) 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.