本文整理汇总了PHP中Tinebase_User::syncUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_User::syncUser方法的具体用法?PHP Tinebase_User::syncUser怎么用?PHP Tinebase_User::syncUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_User
的用法示例。
在下文中一共展示了Tinebase_User::syncUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSyncUserStatus
/**
* test user status sync tine <-> ldap
*
* @see 0011554: improve ldap account status handling
*/
public function testSyncUserStatus()
{
$user = $this->testAddUser();
// set user status in tine (disabled, expired, enabled)
$statusToTest = array(Tinebase_Model_User::ACCOUNT_STATUS_EXPIRED, Tinebase_Model_User::ACCOUNT_STATUS_DISABLED, Tinebase_Model_User::ACCOUNT_STATUS_EXPIRED, Tinebase_Model_User::ACCOUNT_STATUS_ENABLED);
foreach ($statusToTest as $status) {
Tinebase_User::getInstance()->setStatus($user, $status);
// sync user -> user status should be the same
$syncedUser = Tinebase_User::syncUser($user, array('syncAccountStatus' => true));
$this->assertEquals($status, $syncedUser->accountStatus, print_r($syncedUser->toArray(), true));
}
}
示例2: _getLoginUser
/**
* get login user
*
* @param string $_username
* @param Tinebase_Model_AccessLog $_accessLog
* @return Tinebase_Model_FullUser|NULL
*/
protected function _getLoginUser($_username, Tinebase_Model_AccessLog $_accessLog)
{
$accountsController = Tinebase_User::getInstance();
$user = NULL;
try {
// does the user exist in the user database?
if ($accountsController instanceof Tinebase_User_Interface_SyncAble) {
/**
* catch all exceptions during user data sync
* either it's the first sync and no user data get synchronized or
* we can work with the data synced during previous login
*/
try {
Tinebase_User::syncUser($_username, array('syncContactData' => TRUE));
} catch (Exception $e) {
Tinebase_Core::getLogger()->crit(__METHOD__ . '::' . __LINE__ . ' Failed to sync user data for: ' . $_username . ' reason: ' . $e->getMessage());
Tinebase_Exception::log($e);
}
}
$user = $accountsController->getFullUserByLoginName($_username);
$_accessLog->account_id = $user->getId();
$_accessLog->login_name = $user->accountLoginName;
} catch (Tinebase_Exception_NotFound $e) {
if (Tinebase_Core::isLogLevel(Zend_Log::CRIT)) {
Tinebase_Core::getLogger()->crit(__METHOD__ . '::' . __LINE__ . ' Account ' . $_username . ' not found in account storage.');
}
$_accessLog->result = Tinebase_Auth::FAILURE_IDENTITY_NOT_FOUND;
} catch (Zend_Db_Adapter_Exception $zdae) {
if (Tinebase_Core::isLogLevel(Zend_Log::CRIT)) {
Tinebase_Core::getLogger()->crit(__METHOD__ . '::' . __LINE__ . ' Some database connection failed: ' . $zdae->getMessage());
}
$_accessLog->result = Tinebase_Auth::FAILURE_DATABASE_CONNECTION;
}
return $user;
}
示例3: testSyncUser
/**
* execute Tinebase_User::syncUser
*/
public function testSyncUser()
{
$user = $this->testAddUser();
Tinebase_User::syncUser($user, Tinebase_Application::getInstance()->isInstalled('Addressbook'));
}