Ignore:
Timestamp:
09/09/10 15:56:47 (14 years ago)
Author:
viani
Message:

Ticket #1186 - Correção no array de atributos Ldap retornados pela pesquisa de employee

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/workflow/inc/class.CachedLDAP.inc.php

    r3212 r3225  
    7272        */ 
    7373        private $entryAttributes = array('uid', 'cn', 'givenname', 'mail', 'sn', 'accountstatus', 'uidnumber', 'dn', 'employeenumber', 'cpf', 'telephonenumber'); 
    74          
    75         /** 
    76          * @var array $entryAttributesLDAP Os atributos que serão buscados somente no LDAP.  
    77          * (Alguns campos não são armazenados no banco, e o campo mobile pode ser mais do que um por funcionário) 
     74 
     75        /** 
     76         * @var array $entryAttributesLDAP Attributes thats only exists in LDAP. 
     77         * The attributes mobile and homePhone are not present in databaseCache, because they may have more 
     78         * This is not the very best approach because the best solution should be store all attributes 
     79         * from Ldap into databaseCache 
     80         * than one value 
    7881         * @access private 
    7982         * */ 
     
    135138                /* load the information and establish the connection */ 
    136139                $this->loadLDAP(); 
    137                  
     140 
    138141                $ldapfields = array(); 
    139          
     142 
     143                // Merge the arrays os attributes from databaseCache and Ldap 
    140144                $ldapfields = array_merge($this->entryAttributes,$this->entryAttributesLDAP); 
    141                  
     145 
    142146                /* perform the search */ 
    143147                $resourceIdentifier = ldap_search($this->dataSource, $this->userContext, $ldapQuery, $ldapfields); 
     
    147151                if ($entries['count'] != 1) 
    148152                        return false; 
    149                          
    150             //print_r($entries); 
    151153 
    152154                /* format the output */ 
    153155                $output = array(); 
    154156                foreach ($ldapfields as $attribute) 
    155                         if ($attribute == 'dn') 
     157                        if ($attribute == 'dn' or $attribute == 'mobile' or $attribute == 'homePhone') 
     158                                // Retrieve all occurrencies of mobile and homePhone 
    156159                                $output[$attribute] = $entries[0][$attribute]; 
    157160                        else 
    158                                 $output[$attribute] = $entries[0][$attribute]; 
    159                                  
     161                                // Retrieve first occurrence of other attributes 
     162                                $output[$attribute] = $entries[0][$attribute][0]; 
    160163 
    161164                /* insert the timestamp of the last update */ 
Note: See TracChangeset for help on using the changeset viewer.