当前位置: 首页>>代码示例>>PHP>>正文


PHP Tinebase_User::setBackendType方法代码示例

本文整理汇总了PHP中Tinebase_User::setBackendType方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_User::setBackendType方法的具体用法?PHP Tinebase_User::setBackendType怎么用?PHP Tinebase_User::setBackendType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tinebase_User的用法示例。


在下文中一共展示了Tinebase_User::setBackendType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _updateAccountsStorage

 /**
  * Update accountsStorage
  *
  * @param array $_data
  * @return void
  */
 protected function _updateAccountsStorage($_data)
 {
     $originalBackend = Tinebase_User::getConfiguredBackend();
     $newBackend = $_data['backend'];
     Tinebase_User::setBackendType($_data['backend']);
     $config = isset($_data[$_data['backend']]) ? $_data[$_data['backend']] : $_data;
     Tinebase_User::setBackendConfiguration($config, null, true);
     Tinebase_User::saveBackendConfiguration();
     if ($originalBackend != $newBackend && $this->isInstalled('Addressbook') && $originalBackend == Tinebase_User::SQL) {
         Setup_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . " Switching from {$originalBackend} to {$newBackend} account storage");
         try {
             $db = Setup_Core::getDb();
             $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction($db);
             $this->_migrateFromSqlAccountsStorage();
             Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId);
         } catch (Exception $e) {
             Tinebase_TransactionManager::getInstance()->rollBack();
             Setup_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' ' . $e->getMessage());
             Setup_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' ' . $e->getTraceAsString());
             Tinebase_User::setBackendType($originalBackend);
             Tinebase_User::saveBackendConfiguration();
             throw $e;
         }
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:31,代码来源:Controller.php

示例2: testDeleteBackendConfiguration

 /**
  * delete backend config
  */
 public function testDeleteBackendConfiguration()
 {
     Tinebase_User::setBackendType(Tinebase_User::LDAP);
     $key = 'host';
     Tinebase_User::setBackendConfiguration('configured-host', $key);
     Tinebase_User::deleteBackendConfiguration($key);
     $this->assertEquals('default-host', Tinebase_User::getBackendConfiguration($key, 'default-host'));
     $configOptionsCount = count(Tinebase_User::getBackendConfiguration());
     Tinebase_User::deleteBackendConfiguration('non-existing-key');
     $this->assertEquals($configOptionsCount, count(Tinebase_User::getBackendConfiguration()));
     $this->assertTrue($configOptionsCount > 0, 'user backend config should be not empty');
     Tinebase_User::deleteBackendConfiguration();
     $this->assertTrue(count(Tinebase_User::getBackendConfiguration()) == 0, 'should be empty: ' . print_r(Tinebase_User::getBackendConfiguration(), TRUE));
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:17,代码来源:UserTest.php

示例3: update_2

 /**
  * update to 2.3
  * - move accounts storage configuration from config.inc.php to config db table
  * - changed the way the configuration for default user group name and default admin group name is stored
  *  
  */
 public function update_2()
 {
     $config = Setup_Controller::getInstance()->getConfigData();
     if (!empty($config['accounts'])) {
         if (empty($config['accounts']['backend'])) {
             $config['accounts']['backend'] = 'Sql';
         }
         $backendType = ucfirst($config['accounts']['backend']);
         Tinebase_User::setBackendType($backendType);
         //add default settings
         $defaultConfig = Tinebase_User::getBackendConfigurationDefaults($backendType);
         Tinebase_User::setBackendConfiguration($defaultConfig);
         //override default settings with config.inc.php settings
         if (!empty($config['accounts'][$config['accounts']['backend']])) {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Setting config: ' . print_r($config['accounts'][$config['accounts']['backend']], TRUE));
             }
             Tinebase_User::setBackendConfiguration($config['accounts'][$config['accounts']['backend']]);
         }
         //delete old config settings from config.inc.php
         unset($config['accounts']);
     }
     $defaultUserGroupName = Tinebase_Config::getInstance()->get('Default User Group', 'Users');
     $defaultAdminGroupName = Tinebase_Config::getInstance()->get('Default Admin Group', 'Administrators');
     Tinebase_User::setBackendConfiguration($defaultUserGroupName->value, Tinebase_User::DEFAULT_USER_GROUP_NAME_KEY);
     Tinebase_User::setBackendConfiguration($defaultAdminGroupName->value, Tinebase_User::DEFAULT_ADMIN_GROUP_NAME_KEY);
     //write changes to config table
     Tinebase_User::saveBackendConfiguration();
     Tinebase_Config::getInstance()->delete('Default User Group');
     Tinebase_Config::getInstance()->delete('Default Admin Group');
     $this->setApplicationVersion('Tinebase', '2.3');
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:38,代码来源:Release2.php


注:本文中的Tinebase_User::setBackendType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。