/** * Returns registry data of admin. * @see Tinebase_Application_Json_Abstract * * @return mixed array 'variable name' => 'data' */ public function getRegistryData() { $appConfigDefaults = Admin_Controller::getInstance()->getConfigSettings(); $smtpConfig = $this->_manageSmtpEmailUser ? Tinebase_EmailUser::getConfig(Tinebase_Config::SMTP) : ($smtpConfig = array()); $registryData = array('manageSAM' => $this->_manageSAM, 'manageImapEmailUser' => $this->_manageImapEmailUser, 'manageSmtpEmailUser' => $this->_manageSmtpEmailUser, 'primarydomain' => isset($smtpConfig['primarydomain']) ? $smtpConfig['primarydomain'] : '', 'secondarydomains' => isset($smtpConfig['secondarydomains']) ? $smtpConfig['secondarydomains'] : '', 'defaultPrimaryGroup' => Tinebase_Group::getInstance()->getDefaultGroup()->toArray(), 'defaultInternalAddressbook' => $appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK] !== NULL ? Tinebase_Container::getInstance()->get($appConfigDefaults[Admin_Model_Config::DEFAULTINTERNALADDRESSBOOK])->toArray() : NULL); return $registryData; }
/** * the constructor * */ public function __construct(array $_options = array()) { parent::__construct($_options); $ldapOptions = Tinebase_User::getBackendConfiguration(); $config = Tinebase_EmailUser::getConfig($this->_backendType); $this->_options = array_merge($this->_options, $config); if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) { Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($this->_options, true)); } }
/** * 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)); } }
/** * Returns a user object with raw data from ldap * * @param Tinebase_Model_User $_user * @param array $_ldapEntry * @return Tinebase_Record_Abstract */ protected function _ldap2User(Tinebase_Model_User $_user, array &$_ldapEntry) { $smtpUser = parent::_ldap2User($_user, $_ldapEntry); $emailAliases = array(); $allowedDomains = explode(',', Tinebase_EmailUser::getConfig(Tinebase_Config::SMTP)['secondarydomains']); if (isset($_ldapEntry['mail'])) { foreach ($_ldapEntry['mail'] as $mail) { if (isset($_user['accountEmailAddress']) && $_user['accountEmailAddress'] != $mail) { in_array(substr(strrchr($mail, "@"), 1), $allowedDomains) ? $emailAliases[] = $mail : ($this->_unmanagedMailAdresses[] = $mail); } } } $smtpUser['emailAliases'] = $emailAliases; $smtpUser['emailForwardOnly'] = null; $smtpUser['emailForwards'] = array(); if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) { Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($smtpUser, true)); } return $smtpUser; }
/** * 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); }
/** * the constructor * */ public function __construct(array $_options = array()) { $config = Tinebase_EmailUser::getConfig(Tinebase_Config::SMTP); if ($this->_simpleMailConfig === null && isset($config['simplemail']) && isset($config['simplemail']['base'])) { // load default values = simplemail scheme $this->_issetOrDefault($config['simplemail']['storage_base'], $config['simplemail']['base']); $this->_issetOrDefault($config['simplemail']['storage_rdn'], "cn=%u{tine20}"); $this->_issetOrDefault($config['simplemail']['property_mapping'], array('emailAliases' => "mailalternateaddress", 'emailForwards' => "mailforwardingaddress", 'emailForwardOnly' => "maildiscard:boolean")); $this->_issetOrDefault($config['simplemail']['skeleton'], array('objectclass' => array("simplemail", "mailrouting"), 'mailUserDN' => "%s")); $this->_issetOrDefault($config['simplemail']['readonly'], false); $this->_issetOrDefault($config['simplemail']['scope'], Zend_Ldap::SEARCH_SCOPE_SUB); $this->_simpleMailConfig = $config['simplemail']; $this->_propertyMapping = $config['simplemail']['property_mapping']; $this->_ldap = new Tinebase_Ldap(Tinebase_User::getBackendConfiguration()); #$this->_ldap->connect()->bind(); } else { $this->_simpleMailConfig = NULL; if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) { Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' SMTP config: simpleMail is missing ldap base!'); } } }