/** * try to get an user by loginname * */ public function testGetUserByLoginName() { // add a test user $user = $this->testAddUser(); $testUser = $this->_backend->getFullUserByLoginName($user->accountLoginName); $this->assertEquals($user->accountLoginName, $testUser->accountLoginName); $this->assertEquals('Tinebase_Model_FullUser', get_class($testUser), 'wrong type'); }
/** * read ldap / get users from tine an create mapping * * @return array */ protected function _getUserMapping() { $this->_logger->info(__METHOD__ . '::' . __LINE__ . ' Fetching user mapping ...'); $filter = Zend_Ldap_Filter::andFilter(Zend_Ldap_Filter::string($this->_userBaseFilter)); $mapping = array(); $ldapUsers = $this->_ldap->search($filter, $this->_config->ldap->baseDn, $this->_userSearchScope, array('*', '+')); foreach ($ldapUsers as $user) { $username = $user['uid'][0]; $ldapUuid = $user['entryuuid'][0]; try { $tineUser = $this->_tineUserBackend->getFullUserByLoginName($username); $this->_logger->debug(__METHOD__ . '::' . __LINE__ . ' User ' . $username . ': ' . $tineUser->getId() . ' -> ' . $ldapUuid); $mapping[$tineUser->getId()] = $ldapUuid; } catch (Tinebase_Exception_NotFound $tenf) { $this->_logger->debug(__METHOD__ . '::' . __LINE__ . ' User ' . $username . ' not found.'); } } $this->_logger->info(__METHOD__ . '::' . __LINE__ . ' Found ' . count($mapping) . ' users for the mapping.'); $this->_logger->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($mapping, TRUE)); return $mapping; }