/** * constructs Admin_Frontend_Json */ public function __construct() { // manage samba sam? if (isset(Tinebase_Core::getConfig()->samba)) { $this->_manageSAM = Tinebase_Core::getConfig()->samba->get('manageSAM', false); } // manage email user settings if (Tinebase_EmailUser::manages(Tinebase_Config::IMAP)) { $this->_manageImapEmailUser = TRUE; } if (Tinebase_EmailUser::manages(Tinebase_Config::SMTP)) { $this->_manageSmtpEmailUser = TRUE; } }
/** * return an instance of the current user backend * * @param string $backendType name of the user backend * @return Tinebase_User_Abstract * @throws Tinebase_Exception_InvalidArgument */ public static function factory($backendType) { $options = self::getBackendConfiguration(); // 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)); $options['plugins'] = array(); // manage email user settings if (Tinebase_EmailUser::manages(Tinebase_Config::IMAP)) { try { $options['plugins'][] = Tinebase_EmailUser::getInstance(Tinebase_Config::IMAP); } catch (Exception $e) { if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) { Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' Could not add IMAP EmailUser plugin: ' . $e); } } } if (Tinebase_EmailUser::manages(Tinebase_Config::SMTP)) { try { $options['plugins'][] = Tinebase_EmailUser::getInstance(Tinebase_Config::SMTP); } catch (Exception $e) { if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) { Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' Could not add SMTP EmailUser plugin: ' . $e); } } } switch ($backendType) { case self::ACTIVEDIRECTORY: $result = new Tinebase_User_ActiveDirectory($options); break; case self::LDAP: // manage samba sam? if (isset(Tinebase_Core::getConfig()->samba) && Tinebase_Core::getConfig()->samba->get('manageSAM', FALSE) == true) { $options['plugins'][] = new Tinebase_User_Plugin_Samba(Tinebase_Core::getConfig()->samba->toArray()); } $result = new Tinebase_User_Ldap($options); break; case self::SQL: $result = new Tinebase_User_Sql($options); break; case self::TYPO3: $result = new Tinebase_User_Typo3($options); break; default: throw new Tinebase_Exception_InvalidArgument("User backend type {$backendType} not implemented."); } if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Created user backend of type ' . $backendType); } return $result; }
/** * Check for smtp domains in registry * * @see 0010305: Undefined value in user edit dialog */ public function testRegistryForSMTP() { $smtpConfig = Tinebase_EmailUser::getConfig(Tinebase_Config::SMTP); $primaryDomainConfig = Tinebase_EmailUser::manages(Tinebase_Config::SMTP) && isset($smtpConfig['primarydomain']) ? $smtpConfig['primarydomain'] : ''; $secondaryDomainConfig = Tinebase_EmailUser::manages(Tinebase_Config::SMTP) && isset($smtpConfig['secondarydomains']) ? $smtpConfig['secondarydomains'] : ''; $registryData = $this->_json->getRegistryData(); $this->assertEquals($registryData['primarydomain'], $primaryDomainConfig); $this->assertEquals($registryData['secondarydomains'], $secondaryDomainConfig); }
/** * return an instance of the current user backend * * @param string $backendType name of the user backend * @return Tinebase_User_Abstract * @throws Tinebase_Exception_InvalidArgument */ public static function factory($backendType) { $options = self::getBackendConfiguration(); if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) { Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($options, TRUE)); } $options['plugins'] = array(); // manage email user settings if (Tinebase_EmailUser::manages(Tinebase_Config::IMAP)) { $options['plugins'][] = Tinebase_EmailUser::getInstance(Tinebase_Config::IMAP); } if (Tinebase_EmailUser::manages(Tinebase_Config::SMTP)) { $options['plugins'][] = Tinebase_EmailUser::getInstance(Tinebase_Config::SMTP); } switch ($backendType) { case self::LDAP: // manage samba sam? if (isset(Tinebase_Core::getConfig()->samba) && Tinebase_Core::getConfig()->samba->get('manageSAM', FALSE) == true) { $options['plugins'][] = new Tinebase_User_Plugin_Samba(Tinebase_Core::getConfig()->samba->toArray()); } $result = new Tinebase_User_Ldap($options); break; case self::SQL: $result = new Tinebase_User_Sql($options); break; case self::TYPO3: $result = new Tinebase_User_Typo3($options); break; default: throw new Tinebase_Exception_InvalidArgument("User backend type {$backendType} not implemented."); } if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) { Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Created user backend of type ' . $backendType); } return $result; }