Changeset 3225 for branches/2.2/workflow/inc/class.CachedLDAP.inc.php
- Timestamp:
- 09/09/10 15:56:47 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/workflow/inc/class.CachedLDAP.inc.php
r3212 r3225 72 72 */ 73 73 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 78 81 * @access private 79 82 * */ … … 135 138 /* load the information and establish the connection */ 136 139 $this->loadLDAP(); 137 140 138 141 $ldapfields = array(); 139 142 143 // Merge the arrays os attributes from databaseCache and Ldap 140 144 $ldapfields = array_merge($this->entryAttributes,$this->entryAttributesLDAP); 141 145 142 146 /* perform the search */ 143 147 $resourceIdentifier = ldap_search($this->dataSource, $this->userContext, $ldapQuery, $ldapfields); … … 147 151 if ($entries['count'] != 1) 148 152 return false; 149 150 //print_r($entries);151 153 152 154 /* format the output */ 153 155 $output = array(); 154 156 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 156 159 $output[$attribute] = $entries[0][$attribute]; 157 160 else 158 $output[$attribute] = $entries[0][$attribute];159 161 // Retrieve first occurrence of other attributes 162 $output[$attribute] = $entries[0][$attribute][0]; 160 163 161 164 /* insert the timestamp of the last update */
Note: See TracChangeset
for help on using the changeset viewer.