本文整理汇总了PHP中Tinebase_User::getConfiguredBackend方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_User::getConfiguredBackend方法的具体用法?PHP Tinebase_User::getConfiguredBackend怎么用?PHP Tinebase_User::getConfiguredBackend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_User
的用法示例。
在下文中一共展示了Tinebase_User::getConfiguredBackend方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setFromJson
/**
* fill record from json data
*
* @param array &$data
* @return void
*/
protected function _setFromJson(array &$data)
{
/************* add new relations *******************/
if (isset($data['relations'])) {
foreach ((array) $data['relations'] as $key => $relation) {
if (!isset($relation['id'])) {
$relationData = array('own_model' => 'Sales_Model_Contract', 'own_backend' => 'Sql', 'own_id' => isset($data['id']) ? $data['id'] : 0, 'own_degree' => Tinebase_Model_Relation::DEGREE_SIBLING, 'type' => $relation['type'], 'related_record' => isset($relation['related_record']) ? $relation['related_record'] : array(), 'related_id' => isset($relation['related_id']) ? $relation['related_id'] : NULL);
switch ($relation['type']) {
case self::RELATION_TYPE_ACCOUNT:
$relationData['related_model'] = 'Tinebase_Model_User';
$relationData['related_backend'] = Tinebase_User::getConfiguredBackend();
break;
case self::RELATION_TYPE_CUSTOMER:
$relationData['related_model'] = 'Addressbook_Model_Contact';
$relationData['related_backend'] = Addressbook_Backend_Factory::SQL;
break;
default:
throw new Sales_Exception_UnexpectedValue('Relation type not supported.');
}
// sanitize container id
if (isset($relation['related_record']['container_id']) && is_array($relation['related_record']['container_id'])) {
$data['related_record']['container_id'] = $relation['related_record']['container_id']['id'];
}
$data['relations'][$key] = $relationData;
}
}
}
}
示例2: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (Tinebase_User::getConfiguredBackend() !== Tinebase_User::LDAP) {
$this->markTestSkipped('LDAP backend not enabled');
}
$this->_backend = Tinebase_User::factory(Tinebase_User::LDAP);
}
示例3: testEmailsToAttendeeWithGroups
/**
* @return void
*/
public function testEmailsToAttendeeWithGroups()
{
if (Tinebase_User::getConfiguredBackend() === Tinebase_User::LDAP || Tinebase_User::getConfiguredBackend() === Tinebase_User::ACTIVEDIRECTORY) {
$this->markTestSkipped('FIXME: Does not work with LDAP/AD backend');
}
$event = $this->_getEvent();
$persistentEvent = Calendar_Controller_Event::getInstance()->create($event);
$primaryGroup = Tinebase_Group::getInstance()->getGroupById(Tinebase_Core::getUser()->accountPrimaryGroup);
$newAttendees = array(array('userType' => Calendar_Model_Attender::USERTYPE_USER, 'firstName' => $this->_originalTestUser->accountFirstName, 'lastName' => $this->_originalTestUser->accountLastName, 'partStat' => Calendar_Model_Attender::STATUS_TENTATIVE, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => $this->_originalTestUser->accountEmailAddress), array('userType' => Calendar_Model_Attender::USERTYPE_GROUP, 'displayName' => $primaryGroup->name, 'partStat' => Calendar_Model_Attender::STATUS_NEEDSACTION, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => 'foobar@example.org'));
Calendar_Model_Attender::emailsToAttendee($persistentEvent, $newAttendees, TRUE);
$persistentEvent = Calendar_Controller_Event::getInstance()->update($persistentEvent);
$attendees = clone $persistentEvent->attendee;
Calendar_Model_Attender::resolveAttendee($attendees);
$newAttendees = array();
foreach ($attendees as $attendee) {
$newAttendees[] = array('userType' => $attendee->user_type == 'group' ? Calendar_Model_Attender::USERTYPE_GROUP : Calendar_Model_Attender::USERTYPE_USER, 'partStat' => Calendar_Model_Attender::STATUS_TENTATIVE, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => $attendee->user_type == 'group' ? $attendee->user_id->getId() : $attendee->user_id->email, 'displayName' => $attendee->user_type == 'group' ? $attendee->user_id->name : $attendee->user_id->n_fileas);
}
Calendar_Model_Attender::emailsToAttendee($persistentEvent, $newAttendees, TRUE);
$persistentEvent = Calendar_Controller_Event::getInstance()->update($persistentEvent);
// print_r($persistentEvent->attendee->toArray());
// there must be more than 2 attendees the user, the group + the groupmembers
$this->assertGreaterThan(2, count($persistentEvent->attendee));
// current account must not be a groupmember
$this->assertFalse(!!Calendar_Model_Attender::getAttendee($persistentEvent->attendee, new Calendar_Model_Attender(array('user_type' => Calendar_Model_Attender::USERTYPE_GROUPMEMBER, 'user_id' => $this->_originalTestUser->contact_id))), 'found user as groupmember');
$this->assertEquals(Calendar_Model_Attender::STATUS_TENTATIVE, Calendar_Model_Attender::getOwnAttender($persistentEvent->attendee)->status);
}
示例4: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (Tinebase_User::getConfiguredBackend() !== Tinebase_User::SQL) {
$this->markTestSkipped('SQL backend not enabled');
}
$this->_backend = Tinebase_User::factory(Tinebase_User::SQL);
parent::setUp();
}
示例5: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (Tinebase_User::getConfiguredBackend() === Tinebase_User::ACTIVEDIRECTORY) {
// account email addresses are empty with AD backend
$this->markTestSkipped('skipped for ad backend');
}
Calendar_Controller_Event::getInstance()->sendNotifications(false);
Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
}
示例6: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (Tinebase_User::getConfiguredBackend() !== Tinebase_User::LDAP) {
$this->markTestSkipped('LDAP backend not enabled');
}
$this->_backend = Tinebase_User::factory(Tinebase_User::LDAP);
if (!array_key_exists('Tinebase_User_Plugin_Samba', $this->_backend->getPlugins())) {
$this->markTestSkipped('Samba LDAP plugin not enabled');
}
$this->objects['users'] = array();
}
示例7: tearDown
/**
* Tears down the fixture
* This method is called after a test is executed.
*
* @access protected
*/
protected function tearDown()
{
if (Tinebase_User::getConfiguredBackend() !== Tinebase_User::LDAP) {
return;
}
$this->_groupLDAP->deleteGroups($this->objects['groups']);
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Deleting users: ' . print_r($this->objects['users']->toArray(), true));
}
$this->_userLDAP->deleteUsers($this->objects['users']->getArrayOfIds());
}
示例8: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (Tinebase_User::getConfiguredBackend() !== Tinebase_User::LDAP) {
$this->markTestSkipped('LDAP backend not enabled');
}
$this->_backend = Tinebase_User::getInstance();
if (!array_key_exists('Tinebase_EmailUser_Smtp_LdapMailSchema', $this->_backend->getPlugins())) {
$this->markTestSkipped('Mail LDAP plugin not enabled');
}
$this->objects['users'] = array();
}
示例9: __construct
/**
* the constructor
*
*/
public function __construct(array $_options = array())
{
if (Tinebase_User::getConfiguredBackend() != Tinebase_User::LDAP) {
throw new Tinebase_Exception('No LDAP config found.');
}
$this->_options = array_merge($this->_options, Tinebase_EmailUser::getConfig($this instanceof Tinebase_EmailUser_Imap_Interface ? Tinebase_Config::IMAP : Tinebase_Config::SMTP));
$this->_options = array_merge($this->_options, $_options);
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($this->_options, true));
}
}
示例10: getInstance
/**
* the singleton pattern
*
* @return Tinebase_Group_Abstract
*/
public static function getInstance()
{
if (self::$_instance === NULL) {
$backendType = Tinebase_User::getConfiguredBackend();
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' groups backend: ' . $backendType);
}
self::$_instance = self::factory($backendType);
}
return self::$_instance;
}
示例11: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (Tinebase_User::getConfiguredBackend() !== Tinebase_User::LDAP) {
$this->markTestSkipped('LDAP backend not enabled');
}
$this->_backend = Tinebase_User::factory(Tinebase_User::LDAP);
if (!array_key_exists('Tinebase_EmailUser_Imap_LdapDbmailSchema', $this->_backend->getPlugins())) {
$this->markTestSkipped('Dbmail LDAP plugin not enabled');
}
$this->_config = Tinebase_Config::getInstance()->get(Tinebase_Config::IMAP, new Tinebase_Config_Struct())->toArray();
$this->objects['users'] = array();
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:18,代码来源:LdapDbmailSchemaTest.php
示例12: testMaintenanceModeLoginFail
/**
* testMaintenanceModeLoginFail
*/
public function testMaintenanceModeLoginFail()
{
if (Tinebase_User::getConfiguredBackend() === Tinebase_User::LDAP || Tinebase_User::getConfiguredBackend() === Tinebase_User::ACTIVEDIRECTORY) {
$this->markTestSkipped('FIXME: Does not work with LDAP/AD backend (full test suite run)');
}
Tinebase_Config::getInstance()->maintenanceMode = 1;
try {
$this->_instance->login('sclever', Tinebase_Helper::array_value('password', TestServer::getInstance()->getTestCredentials()), new \Zend\Http\PhpEnvironment\Request());
$this->fail('expecting exception: Tinebase_Exception_MaintenanceMode');
} catch (Tinebase_Exception_MaintenanceMode $temm) {
$this->assertEquals('Installation is in maintenance mode. Please try again later', $temm->getMessage());
}
}
示例13: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*/
public function setUp()
{
if (Tinebase_User::getConfiguredBackend() === Tinebase_User::ACTIVEDIRECTORY) {
// account email addresses are empty with AD backend
$this->markTestSkipped('skipped for ad backend');
}
parent::setUp();
$this->objects['initialContainer'] = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => Tinebase_Record_Abstract::generateUID(), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId())));
$this->objects['sharedContainer'] = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => Tinebase_Record_Abstract::generateUID(), 'type' => Tinebase_Model_Container::TYPE_SHARED, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId())));
$prefs = new Calendar_Preference();
$prefs->setValue(Calendar_Preference::DEFAULTCALENDAR, $this->objects['initialContainer']->getId());
$_SERVER['REQUEST_URI'] = 'lars';
}
示例14: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->_backend = Tinebase_User::getInstance();
if (!array_key_exists('Tinebase_EmailUser_Smtp_Postfix', $this->_backend->getPlugins())) {
$this->markTestSkipped('Postfix SQL plugin not enabled');
}
if (Tinebase_User::getConfiguredBackend() === Tinebase_User::ACTIVEDIRECTORY) {
// error: Zend_Ldap_Exception: 0x44 (Already exists; 00002071: samldb: Account name (sAMAccountName)
// 'tine20phpunituser' already in use!): adding: cn=PHPUnit User Tine 2.0,cn=Users,dc=example,dc=org
$this->markTestSkipped('skipped for ad backends as it does not allow duplicate CNs');
}
$this->objects['users'] = array();
$this->_mailDomain = TestServer::getPrimaryMailDomain();
}
示例15: _setupConfigOptions
/**
* set config options (accounts/authentication/email/...)
*
* @param array $_options
*/
protected function _setupConfigOptions($_options)
{
// ignore empty options
foreach ($_options as $key => $value) {
if (empty($_options[$key])) {
unset($_options[$key]);
}
}
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Saving config options (accounts/authentication/email/...)');
}
// this is a dangerous TRACE as there might be passwords in here!
//if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_options, TRUE));
$defaults = empty($_options['authenticationData']) ? Setup_Controller::getInstance()->loadAuthenticationData() : $_options['authenticationData'];
$defaultGroupNames = $this->_parseDefaultGroupNameOptions($_options);
$defaults['accounts'][Tinebase_User::getConfiguredBackend()] = array_merge($defaults['accounts'][Tinebase_User::getConfiguredBackend()], $defaultGroupNames);
$emailConfigKeys = Setup_Controller::getInstance()->getEmailConfigKeys();
$configsToSet = array_merge($emailConfigKeys, array('authentication', 'accounts', 'redirectSettings', 'acceptedTermsVersion'));
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($configsToSet, TRUE));
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($defaults, TRUE));
}
$optionsToSave = array();
foreach ($configsToSet as $group) {
if (isset($_options[$group])) {
$parsedOptions = is_string($_options[$group]) ? Setup_Frontend_Cli::parseConfigValue($_options[$group]) : $_options[$group];
switch ($group) {
case 'authentication':
case 'accounts':
$backend = isset($parsedOptions['backend']) ? ucfirst($parsedOptions['backend']) : Tinebase_User::SQL;
$optionsToSave[$group][$backend] = isset($parsedOptions[$backend]) ? $parsedOptions[$backend] : $parsedOptions;
$optionsToSave[$group]['backend'] = $backend;
break;
default:
$optionsToSave[$group] = $parsedOptions;
}
} else {
if (isset($defaults[$group])) {
$optionsToSave[$group] = $defaults[$group];
}
}
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($optionsToSave, TRUE));
}
Setup_Controller::getInstance()->saveEmailConfig($optionsToSave);
Setup_Controller::getInstance()->saveAuthentication($optionsToSave);
}