mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-01 00:03:18 +01:00
LdapObject : add __toString() method
Fix password recovery bug report by Adrien Malgoyre <adrien.malgoyre@osupytheas.fr> on Ldapsaisie-devel mailing list.
This commit is contained in:
parent
05d4414a41
commit
7f1fa41e3a
1 changed files with 16 additions and 0 deletions
|
@ -1857,6 +1857,22 @@ class LSldapObject {
|
|||
return LSconfig :: get($param, $default, $cast, $this -> config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow conversion of LdapObject to string
|
||||
*
|
||||
* @retval string The string representation of the LdapObject
|
||||
*/
|
||||
public function __toString() {
|
||||
if ($this -> dn)
|
||||
return "<LdapObject ".$this -> dn.">";
|
||||
$rdn_attr = $this -> getConfig('rdn');
|
||||
if( $rdn_attr && isset($this -> attrs[$rdn_attr]) ) {
|
||||
$rdn_val = $this -> attrs[$rdn_attr] -> getUpdateData();
|
||||
if (!empty($rdn_val))
|
||||
return "<LdapObject (new) $rdn_attr=".$rdn_val[0].">";
|
||||
}
|
||||
return "<LdapObject (new)>";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue