public function testPasswordSettingCustomAttribute() { $data = array(); Zend_Ldap_Attribute::setPassword($data, 'pa$$w0rd', Zend_Ldap_Attribute::PASSWORD_HASH_SHA, 'myAttribute'); $password = Zend_Ldap_Attribute::getAttribute($data, 'myAttribute', 0); $this->assertNotNull($password); }
/** * Gets a LDAP attribute. * * This is an offline method. * * @param string $name * @param integer $index * @return mixed * @throws Zend_Ldap_Exception */ public function getAttribute($name, $index = null) { if ($name == 'dn') { return $this->getDnString(); } else { return Zend_Ldap_Attribute::getAttribute($this->_currentData, $name, $index); } }
/** * Returns the value for the given LDAP attribute. * * @param array $entry LDAP entry * @param string $attribName Attribute name. * * @return mixed LDAP attribute value */ protected function _getLDAPAttribute($entry, $attribName, $index = 0) { $attribName = strtolower($attribName); if (!isset($entry[$attribName])) { return null; } else { if (is_array($entry[$attribName])) { return Zend_Ldap_Attribute::getAttribute($entry, $attribName, $index); } else { return $entry[$attribName]; } } }