LSldap :: getAttrs: add possibility to specify to custom LDAP filter

This commit is contained in:
Benjamin Renard 2020-05-14 11:05:08 +02:00
parent 9bb52296b7
commit 252095b32b

View file

@ -192,12 +192,16 @@ class LSldap extends LSlog_staticLoggerClass {
*
* @retval array Tableau associatif des valeurs des attributs avec en clef, le nom de l'attribut.
*/
public static function getAttrs($dn) {
public static function getAttrs($dn, $filter=null) {
$infos = ldap_explode_dn($dn,0);
if((!$infos)||($infos['count']==0))
return;
$return=self :: search('(objectClass=*)',$dn);
if (!$filter)
$filter = '(objectClass=*)';
$return = self :: search($filter, $dn);
if (is_array($return) && count($return) == 1)
return $return[0]['attrs'];
return false;
}
/**