|
dolibarr
x.y.z
|
Class to manage LDAP features. More...

Public Member Functions | |
| __construct () | |
| Constructor. | |
| connect_bind () | |
| Connect and bind Use this->server, this->serverPort, this->ldapProtocolVersion, this->serverType, this->searchUser, this->searchPassword After return, this->connection and $this->bind are defined. More... | |
| close () | |
| Simply closes the connection set up earlier. More... | |
| bind () | |
| Anonymously binds to the connection. More... | |
| bindauth ($bindDn, $pass) | |
| Binds as an authenticated user, which usually allows for write access. More... | |
| unbind () | |
| Unbind of LDAP server (close connection). More... | |
| getVersion () | |
| Verification de la version du serveur ldap. More... | |
| setVersion () | |
| Change ldap protocol version to use. More... | |
| setReferrals () | |
| changement du referrals. More... | |
| add ($dn, $info, $user) | |
| Add a LDAP entry Ldap object connect and bind must have been done. More... | |
| modify ($dn, $info, $user) | |
| Modify a LDAP entry Ldap object connect and bind must have been done. More... | |
| rename ($dn, $newrdn, $newparent, $user, $deleteoldrdn=true) | |
| Rename a LDAP entry Ldap object connect and bind must have been done. More... | |
| 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. More... | |
| delete ($dn) | |
| Delete a LDAP entry Ldap object connect and bind must have been done. More... | |
| dump_content ($dn, $info) | |
| Build a LDAP message. More... | |
| dump ($dn, $info) | |
| Dump a LDAP message to ldapinput.in file. More... | |
| serverPing ($host, $port=389, $timeout=1) | |
| Ping a server before ldap_connect for avoid waiting. More... | |
| addAttribute ($dn, $info, $user) | |
| Add a LDAP attribute in entry Ldap object connect and bind must have been done. More... | |
| updateAttribute ($dn, $info, $user) | |
| Update a LDAP attribute in entry Ldap object connect and bind must have been done. More... | |
| deleteAttribute ($dn, $info, $user) | |
| Delete a LDAP attribute in entry Ldap object connect and bind must have been done. More... | |
| getAttribute ($dn, $filter) | |
| Returns an array containing attributes and values for first record. More... | |
| getAttributeValues ($filterrecord, $attribute) | |
| Returns an array containing values for an attribute and for first record matching filterrecord. More... | |
| getRecords ($search, $userDn, $useridentifier, $attributeArray, $activefilter=0, $attributeAsArray=array()) | |
| Returns an array containing a details or list of LDAP record(s). More... | |
| littleEndian ($hex) | |
| Converts a little-endian hex-number to one, that 'hexdec' can convert Required by Active Directory. More... | |
| getObjectSid ($ldapUser) | |
| Recupere le SID de l'utilisateur Required by Active Directory. More... | |
| binSIDtoText ($binsid) | |
| Returns the textual SID Indispensable pour Active Directory. More... | |
| search ($checkDn, $filter) | |
| Fonction de recherche avec filtre this->connection doit etre defini donc la methode bind ou bindauth doit avoir deja ete appelee Ne pas utiliser pour recherche d'une liste donnee de proprietes car conflit majuscule-minuscule. More... | |
| fetch ($user, $filter) | |
| Load all attribute of a LDAP user. More... | |
| getUserIdentifier () | |
| Returns the correct user identifier to use, based on the ldap server type. More... | |
| parseUACF ($uacf) | |
| UserAccountControl Flgs to more human understandable form... More... | |
| parseSAT ($samtype) | |
| SamAccountType value to text. More... | |
| convert_time ($value) | |
| Convertit le temps ActiveDirectory en Unix timestamp. More... | |
| convFromOutputCharset ($str, $pagecodeto='UTF-8') | |
| Convert a string from output/memory charset. More... | |
| getNextGroupGid ($keygroup='LDAP_KEY_GROUPS') | |
| Return available value of group GID. More... | |
Public Attributes | |
| $server = array() | |
| Tableau des serveurs (IP addresses ou nom d'hotes) | |
| $connectedServer | |
| Current connected server. | |
| $dn | |
| Base DN (e.g. More... | |
| $serverType | |
| type de serveur, actuellement OpenLdap et Active Directory | |
| $ldapProtocolVersion | |
| Version du protocole ldap. | |
| $domain | |
| Server DN. | |
| $searchUser | |
| User administrateur Ldap Active Directory ne supporte pas les connexions anonymes. | |
| $searchPassword | |
| Mot de passe de l'administrateur Active Directory ne supporte pas les connexions anonymes. | |
| $people | |
| DN des utilisateurs. | |
| $groups | |
| DN des groupes. | |
| $ldapErrorCode | |
| Code erreur retourne par le serveur Ldap. | |
| $ldapErrorText | |
| Message texte de l'erreur. | |
| $connection | |
| The internal LDAP connection handle. | |
| $result | |
| Result of any connections etc. | |
| const | SYNCHRO_NONE = 0 |
| No Ldap synchronization. | |
| const | SYNCHRO_DOLIBARR_TO_LDAP = 1 |
| Dolibarr to Ldap synchronization. | |
| const | SYNCHRO_LDAP_TO_DOLIBARR = 2 |
| Ldap to Dolibarr synchronization. | |
Private Member Functions | |
| convToOutputCharset ($str, $pagecodefrom='UTF-8') | |
| Convert a string into output/memory charset. More... | |
Class to manage LDAP features.
Definition at line 34 of file ldap.class.php.
| Ldap::add | ( | $dn, | |
| $info, | |||
| $user | |||
| ) |
Add a LDAP entry Ldap object connect and bind must have been done.
| string | $dn | DN entry key |
| array | $info | Attributes array |
| User | $user | Objet user that create |
Definition at line 461 of file ldap.class.php.
| Ldap::addAttribute | ( | $dn, | |
| $info, | |||
| $user | |||
| ) |
Add a LDAP attribute in entry Ldap object connect and bind must have been done.
| string | $dn | DN entry key |
| array | $info | Attributes array |
| User | $user | Objet user that create |
Definition at line 810 of file ldap.class.php.
| Ldap::bind | ( | ) |
Anonymously binds to the connection.
After this is done, queries and searches can be done - but read-only.
Definition at line 361 of file ldap.class.php.
| Ldap::bindauth | ( | $bindDn, | |
| $pass | |||
| ) |
Binds as an authenticated user, which usually allows for write access.
The FULL dn must be passed. For a directory manager, this is "cn=Directory Manager" under iPlanet. For a user, it will be something like "uid=jbloggs,ou=People,dc=foo,dc=com".
| string | $bindDn | DN |
| string | $pass | Password |
Definition at line 383 of file ldap.class.php.
Referenced by getObjectSid().
| Ldap::binSIDtoText | ( | $binsid | ) |
Returns the textual SID Indispensable pour Active Directory.
| string | $binsid | Binary SID |
Definition at line 1189 of file ldap.class.php.
| Ldap::close | ( | ) |
Simply closes the connection set up earlier.
Returns true if OK, false if there was an error. This method seems a duplicate/alias of unbind().
Definition at line 345 of file ldap.class.php.
| Ldap::connect_bind | ( | ) |
Connect and bind Use this->server, this->serverPort, this->ldapProtocolVersion, this->serverType, this->searchUser, this->searchPassword After return, this->connection and $this->bind are defined.
Definition at line 192 of file ldap.class.php.
| Ldap::convert_time | ( | $value | ) |
Convertit le temps ActiveDirectory en Unix timestamp.
| string | $value | AD time to convert |
Definition at line 1427 of file ldap.class.php.
| Ldap::convFromOutputCharset | ( | $str, | |
$pagecodeto = 'UTF-8' |
|||
| ) |
Convert a string from output/memory charset.
| string | $str | String to convert |
| string | $pagecodeto | Page code for result string |
Definition at line 1464 of file ldap.class.php.
|
private |
Convert a string into output/memory charset.
| string | $str | String to convert |
| string | $pagecodefrom | Page code of src string |
Definition at line 1445 of file ldap.class.php.
| Ldap::delete | ( | $dn | ) |
Delete a LDAP entry Ldap object connect and bind must have been done.
| string | $dn | DN entry key |
Definition at line 661 of file ldap.class.php.
References $dn, and dol_syslog().
| Ldap::deleteAttribute | ( | $dn, | |
| $info, | |||
| $user | |||
| ) |
Delete a LDAP attribute in entry Ldap object connect and bind must have been done.
| string | $dn | DN entry key |
| array | $info | Attributes array |
| User | $user | Objet user that create |
Definition at line 902 of file ldap.class.php.
| Ldap::dump | ( | $dn, | |
| $info | |||
| ) |
Dump a LDAP message to ldapinput.in file.
| string | $dn | DN entry key |
| array | $info | Attributes array |
Definition at line 731 of file ldap.class.php.
| Ldap::dump_content | ( | $dn, | |
| $info | |||
| ) |
Build a LDAP message.
| string | $dn | DN entry key |
| array | $info | Attributes array |
Definition at line 694 of file ldap.class.php.
| Ldap::fetch | ( | $user, | |
| $filter | |||
| ) |
Load all attribute of a LDAP user.
| User | string | $user | Not used. |
| string | $filter | Filter for search. Must start with &. Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com) |
Definition at line 1247 of file ldap.class.php.
| Ldap::getAttribute | ( | $dn, | |
| $filter | |||
| ) |
Returns an array containing attributes and values for first record.
| string | $dn | DN entry key |
| string | $filter | Filter |
Definition at line 946 of file ldap.class.php.
| Ldap::getAttributeValues | ( | $filterrecord, | |
| $attribute | |||
| ) |
Returns an array containing values for an attribute and for first record matching filterrecord.
| string | $filterrecord | Record |
| string | $attribute | Attributes |
Definition at line 987 of file ldap.class.php.
| Ldap::getNextGroupGid | ( | $keygroup = 'LDAP_KEY_GROUPS' | ) |
Return available value of group GID.
| string | $keygroup | Key of group |
Definition at line 1483 of file ldap.class.php.
| Ldap::getObjectSid | ( | $ldapUser | ) |
Recupere le SID de l'utilisateur Required by Active Directory.
| string | $ldapUser | Login de l'utilisateur |
Definition at line 1139 of file ldap.class.php.
References bindauth().
| Ldap::getRecords | ( | $search, | |
| $userDn, | |||
| $useridentifier, | |||
| $attributeArray, | |||
$activefilter = 0, |
|||
$attributeAsArray = array() |
|||
| ) |
Returns an array containing a details or list of LDAP record(s).
ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword
| string | $search | Value of field to search, '*' for all. Not used if $activefilter is set. |
| string | $userDn | DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org) |
| string | $useridentifier | Name of key field (Ex: uid). |
| array | $attributeArray | Array of fields required. Note this array must also contains field $useridentifier (Ex: sn,userPassword) |
| int | $activefilter | '1' or 'user'=use field this->filter as filter instead of parameter $search, 'group'=use field this->filtergroup as filter, 'member'=use field this->filtermember as filter |
| array | $attributeAsArray | Array of fields wanted as an array not a string |
Definition at line 1030 of file ldap.class.php.
| Ldap::getUserIdentifier | ( | ) |
Returns the correct user identifier to use, based on the ldap server type.
Definition at line 1332 of file ldap.class.php.
| Ldap::getVersion | ( | ) |
Verification de la version du serveur ldap.
Definition at line 420 of file ldap.class.php.
| Ldap::littleEndian | ( | $hex | ) |
Converts a little-endian hex-number to one, that 'hexdec' can convert Required by Active Directory.
| string | $hex | Hex value |
Definition at line 1122 of file ldap.class.php.
References $result, and dol_strlen().
| Ldap::modify | ( | $dn, | |
| $info, | |||
| $user | |||
| ) |
Modify a LDAP entry Ldap object connect and bind must have been done.
| string | $dn | DN entry key |
| array | $info | Attributes array |
| User | $user | Objet user that modify |
Definition at line 509 of file ldap.class.php.
| Ldap::parseSAT | ( | $samtype | ) |
SamAccountType value to text.
| string | $samtype | SamType |
Definition at line 1394 of file ldap.class.php.
| Ldap::parseUACF | ( | $uacf | ) |
UserAccountControl Flgs to more human understandable form...
| string | $uacf | UACF |
Definition at line 1347 of file ldap.class.php.
| Ldap::rename | ( | $dn, | |
| $newrdn, | |||
| $newparent, | |||
| $user, | |||
$deleteoldrdn = true |
|||
| ) |
Rename a LDAP entry Ldap object connect and bind must have been done.
| string | $dn | Old DN entry key (uid=qqq,ou=xxx,dc=aaa,dc=bbb) (before update) |
| string | $newrdn | New RDN entry key (uid=qqq) |
| string | $newparent | New parent (ou=xxx,dc=aaa,dc=bbb) |
| User | $user | Objet user that modify |
| bool | $deleteoldrdn | If true the old RDN value(s) is removed, else the old RDN value(s) is retained as non-distinguished values of the entry. |
Definition at line 567 of file ldap.class.php.
| Ldap::search | ( | $checkDn, | |
| $filter | |||
| ) |
Fonction de recherche avec filtre this->connection doit etre defini donc la methode bind ou bindauth doit avoir deja ete appelee Ne pas utiliser pour recherche d'une liste donnee de proprietes car conflit majuscule-minuscule.
A n'utiliser que pour les pages 'Fiche LDAP' qui affiche champ lisibles par defaut.
| string | $checkDn | DN de recherche (Ex: ou=users,cn=my-domain,cn=com) |
| string | $filter | Search filter (ex: (sn=nom_personne) ) |
Definition at line 1214 of file ldap.class.php.
| Ldap::serverPing | ( | $host, | |
$port = 389, |
|||
$timeout = 1 |
|||
| ) |
Ping a server before ldap_connect for avoid waiting.
| string | $host | Server host or address |
| int | $port | Server port (default 389) |
| int | $timeout | Timeout in second (default 1s) |
Definition at line 763 of file ldap.class.php.
| Ldap::setReferrals | ( | ) |
| Ldap::setVersion | ( | ) |
Change ldap protocol version to use.
Definition at line 432 of file ldap.class.php.
| Ldap::unbind | ( | ) |
Unbind of LDAP server (close connection).
Definition at line 401 of file ldap.class.php.
| Ldap::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.
| string | $dn | DN entry key |
| array | $info | Attributes array |
| User | $user | Objet user that update |
| string | $olddn | Old DN entry key (before update) |
| string | $newrdn | New RDN entry key (uid=qqq) (for ldap_rename) |
| string | $newparent | New parent (ou=xxx,dc=aaa,dc=bbb) (for ldap_rename) |
Definition at line 611 of file ldap.class.php.
| Ldap::updateAttribute | ( | $dn, | |
| $info, | |||
| $user | |||
| ) |
Update a LDAP attribute in entry Ldap object connect and bind must have been done.
| string | $dn | DN entry key |
| array | $info | Attributes array |
| User | $user | Objet user that create |
Definition at line 856 of file ldap.class.php.
| Ldap::$dn |
Base DN (e.g.
"dc=foo,dc=com")
Definition at line 59 of file ldap.class.php.
Referenced by delete().