1
0
Fork 0
mirror of https://gitlab.easter-eggs.com/ee/ldapsaisie.git synced 2024-12-23 00:43:48 +01:00

- LSldap :

-> Ajout de la méthode getLdapEntry()
  -> Utilisation de la méthode getLdapEntry() dans getEntry()
This commit is contained in:
Benjamin Renard 2009-04-15 14:04:21 +00:00
parent dfb97bb95f
commit 3362273688

View file

@ -186,14 +186,8 @@ class LSldap {
public static function getEntry($object_type,$dn) {
$obj_conf=LSconfig :: get('LSobjects.'.$object_type);
if(is_array($obj_conf)){
$entry = self :: $cnx -> getEntry($dn);
if (Net_LDAP2::isError($entry)) {
//$newentry = new Net_LDAP2_Entry(&self :: $cnx);
//$newentry -> dn($dn);
//$newentry -> add(array('objectclass' => $obj_conf['objectclass']));
//foreach($obj_conf['attrs'] as $attr_name => $attr_conf) {
// $newentry->add(array($attr_name => $attr_conf['default_value']));
//}
$entry = self :: getLdapEntry($dn);
if ($entry === false) {
$attributes = array();
foreach($obj_conf['attrs'] as $attr_name => $attr_conf) {
if( isset($attr_conf['default_value']) ) {
@ -218,6 +212,26 @@ class LSldap {
}
}
/**
* Retourne un object NetLDAP d'une entree existante
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $dn string DN de l'entré Ldap
*
* @retval ldapentry|boolean Un objet ldapentry (PEAR::Net_LDAP2) ou false en
* cas de problème
*/
public static function getLdapEntry($dn) {
$entry = self :: $cnx -> getEntry($dn);
if (Net_LDAP2::isError($entry)) {
return false;
}
else {
return $entry;
}
}
/**
* Retourne une nouvelle entrée
*