LSldap: translate comments

This commit is contained in:
Benjamin Renard 2022-03-07 16:06:39 +01:00
parent 9d3e69c86d
commit faad922f03

View file

@ -23,9 +23,9 @@
LSsession :: loadLSclass('LSlog_staticLoggerClass'); LSsession :: loadLSclass('LSlog_staticLoggerClass');
/** /**
* Gestion de l'accès à l'annaire Ldap * Manage access to LDAP directory
* *
* Cette classe gère l'accès à l'annuaire ldap en s'appuyant sur PEAR :: Net_LDAP2 * This class hangle LDAP directory access using PEAR :: Net_LDAP2.
* *
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
*/ */
@ -35,13 +35,13 @@ class LSldap extends LSlog_staticLoggerClass {
private static $cnx = NULL; private static $cnx = NULL;
/** /**
* D<EFBFBD>fini la configuration * Set configuration
* *
* Cette methode définis la configuration de l'accès à l'annuaire * This method permit to define LDAP server access configuration
* *
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
* *
* @param[in] $config array Tableau de configuration au format Net_LDAP2 * @param[in] $config array Configuration array as accepted by Net_LDAP2
* *
* @retval void * @retval void
*/ */
@ -137,9 +137,9 @@ class LSldap extends LSlog_staticLoggerClass {
} }
/** /**
* Déconnection * Disconnect
* *
* Cette methode clos la connexion à l'annuaire Ldap * This method permit to close the connection to the LDAP server
* *
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
* *
@ -150,23 +150,23 @@ class LSldap extends LSlog_staticLoggerClass {
} }
/** /**
* Recherche dans l'annuaire * Search in LDAP directory
* *
* Cette methode effectue une recherche dans l'annuaire et retourne le resultat * This method make a search in LDAP directory and return the result as an array.
* de celle-ci sous la forme d'un tableau.
* *
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
* *
* @param[in] $filter [<b>required</b>] string Filtre de recherche Ldap * @param[in] $filter [<b>required</b>] string The search LDAP filter
* @param[in] $basedn string DN de base pour la recherche * @param[in] $basedn string The base DN of the search
* @param[in] $params array Paramètres de recherche au format Net_LDAP2::search() * @param[in] $params array Array to search parameters as accepted by Net_LDAP2::search()
* *
* @see Net_LDAP2::search() * @see Net_LDAP2::search()
* *
* @retval array Retourne un tableau associatif contenant : * @retval array Return an array of entries returned by the LDAP directory. Each element
* - ['dn'] : le DN de l'entré * of this array corresponded to one returned entry and is an array with
* - ['attrs'] : tableau associatif contenant les attributs (clé) * the following keys:
* et leur valeur (valeur). * - dn: The DN of the entry
* - attrs: Associative array of the entry's attributes values
*/ */
public static function search($filter, $basedn=NULL, $params=array()) { public static function search($filter, $basedn=NULL, $params=array()) {
$filterstr = (is_a($filter, 'Net_LDAP2_Filter')?$filter->as_string():$filter); $filterstr = (is_a($filter, 'Net_LDAP2_Filter')?$filter->as_string():$filter);
@ -200,20 +200,20 @@ class LSldap extends LSlog_staticLoggerClass {
} }
/** /**
* Compte le nombre de retour d'une recherche dans l'annuaire * Count the number of mathching objects found in LDAP directory
* *
* Cette methode effectue une recherche dans l'annuaire et retourne le nombre * This method make a search in LDAP directory and return the number of
* d'entrés trouvées. * macthing entries.
* *
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
* *
* @param[in] $filter [<b>required</b>] string Filtre de recherche Ldap * @param[in] $filter [<b>required</b>] string The search LDAP filter
* @param[in] $basedn string DN de base pour la recherche * @param[in] $basedn string The base DN of the search
* @param[in] $params array Paramètres de recherche au format Net_LDAP2::search() * @param[in] $params array Array to search parameters as accepted by Net_LDAP2::search()
* *
* @see Net_LDAP2::search() * @see Net_LDAP2::search()
* *
* @retval numeric Le nombre d'entré trouvées * @retval integer|null The number of matching entries on success, null otherwise
*/ */
public static function getNumberResult($filter, $basedn=NULL, $params=array()) { public static function getNumberResult($filter, $basedn=NULL, $params=array()) {
if (empty($filter)) if (empty($filter))
@ -372,17 +372,17 @@ class LSldap extends LSlog_staticLoggerClass {
} }
/** /**
* Met à jour une entrée dans l'annuaire * Update an entry in LDAP
* *
* Remarque : Supprime les valeurs vides de attributs et les attributs sans valeur. * Note: this method drop empty attribute values and attributes without value.
* *
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
* *
* @param[in] $object_type string Type de l'objet Ldap * @param[in] $object_type string The object type
* @param[in] $dn string DN de l'entré Ldap * @param[in] $dn string DN of the LDAP object
* @param[in] $change array Tableau des modifications à apporter * @param[in] $change array Array of object attributes changes
* *
* @retval boolean true si l'objet a bien été mis à jour, false sinon * @retval boolean True if object was updated, False otherwise.
*/ */
public static function update($object_type, $dn, $change) { public static function update($object_type, $dn, $change) {
self :: log_trace("update($object_type, $dn): change=".varDump($change)); self :: log_trace("update($object_type, $dn): change=".varDump($change));
@ -484,14 +484,14 @@ class LSldap extends LSlog_staticLoggerClass {
} }
/** /**
* Test de bind * Test to bind to LDAP directory
* *
* Cette methode établie une connexion à l'annuaire Ldap et test un bind * This method establish a connection to the LDAP server and test
* avec un login et un mot de passe passé en paramètre * to bind with provided DN and password.
* *
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
* *
* @retval boolean true si la connection à réussi, false sinon * @retval boolean True on bind success, False otherwise.
*/ */
public static function checkBind($dn,$pwd) { public static function checkBind($dn,$pwd) {
$config = self :: $config; $config = self :: $config;
@ -505,20 +505,20 @@ class LSldap extends LSlog_staticLoggerClass {
} }
/** /**
* Retourne l'état de la connexion Ldap * Return the status of the LDAP connection
* *
* @retval boolean True si le serveur est connecté, false sinon. * @retval boolean True if connected on LDAP server, False otherwise
*/ */
public static function isConnected() { public static function isConnected() {
return (self :: $cnx == NULL)?false:true; return (self :: $cnx == NULL)?false:true;
} }
/** /**
* Supprime un objet de l'annuaire * Drop an object in LDAP directory
* *
* @param[in] string DN de l'objet à supprimer * @param[in] string The DN of the object to remove
* *
* @retval boolean True si l'objet à été supprimé, false sinon * @retval boolean True if object was removed, False otherwise.
*/ */
public static function remove($dn) { public static function remove($dn) {
$ret = self :: $cnx -> delete($dn,array('recursive' => true)); $ret = self :: $cnx -> delete($dn,array('recursive' => true));
@ -530,14 +530,14 @@ class LSldap extends LSlog_staticLoggerClass {
} }
/** /**
* D<EFBFBD>place un objet LDAP dans l'annuaire * Move an entry in LDAP directory
* *
* @param[in] $old string Le DN actuel * @param[in] $old string The current object DN
* @param[in] $new string Le futur DN * @param[in] $new string The new object DN
* *
* @retval boolean True si l'objet a <EFBFBD>t<EFBFBD> d<EFBFBD>plac<EFBFBD>, false sinon * @retval boolean True if object was moved, False otherwise.
*/ */
public static function move($old,$new) { public static function move($old, $new) {
$ret = self :: $cnx -> move($old, $new); $ret = self :: $cnx -> move($old, $new);
if (Net_LDAP2::isError($ret)) { if (Net_LDAP2::isError($ret)) {
LSerror :: addErrorCode('LSldap_07'); LSerror :: addErrorCode('LSldap_07');
@ -550,11 +550,19 @@ class LSldap extends LSlog_staticLoggerClass {
/** /**
* Combine LDAP Filters * Combine LDAP Filters
* *
* @params array Array of LDAP filters * @param[in] $op string The combine logical operator. May be "and",
* "or", "not" or the subsequent logical
* equivalents "&", "|", "!".
* @param[in] $filters array Array of LDAP filters (as string or
* Net_LDAP2_Filter object)
* @param[in] $asStr boolean Set to true if you want to retreive
* combined filter as string instead of
* as a Net_LDAP2_Filter object (optional,
* default: false)
* *
* @retval Net_LDAP2_Filter | False The combined filter or False * @retval Net_LDAP2_Filter | False The combined filter or False
**/ **/
public static function combineFilters($op,$filters,$asStr=false) { public static function combineFilters($op, $filters, $asStr=false) {
if (is_array($filters) && !empty($filters)) { if (is_array($filters) && !empty($filters)) {
if (count($filters)==1) { if (count($filters)==1) {
if ($asStr && $filters[0] instanceof Net_LDAP2_Filter) { if ($asStr && $filters[0] instanceof Net_LDAP2_Filter) {