本文整理汇总了PHP中Tinebase_User::getBackendConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_User::getBackendConfiguration方法的具体用法?PHP Tinebase_User::getBackendConfiguration怎么用?PHP Tinebase_User::getBackendConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_User
的用法示例。
在下文中一共展示了Tinebase_User::getBackendConfiguration方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_0
/**
* update to 6.1
* - changepw config option has moved
*/
public function update_0()
{
$changepwSetting = Tinebase_User::getBackendConfiguration('changepw', TRUE);
if (!$changepwSetting) {
Tinebase_Config::getInstance()->set(Tinebase_Config::PASSWORD_CHANGE, FALSE);
}
$this->setApplicationVersion('Tinebase', '6.1');
}
示例2: __construct
/**
* the constructor
*
* don't use the constructor. use the singleton
*/
private function __construct()
{
if (!Tinebase_Core::getConfig()->samba) {
throw new Admin_Exception('No samba settings defined in config.');
}
if (Tinebase_User::getConfiguredBackend() != Tinebase_User::LDAP) {
throw new Admin_Exception('Works only with LDAP user backend.');
}
$ldapOptions = Tinebase_User::getBackendConfiguration();
$sambaOptions = Tinebase_Core::getConfig()->samba->toArray();
$options = array_merge($ldapOptions, $sambaOptions);
$options['machineGroup'] = isset($options['machineGroup']) ? $options['machineGroup'] : 'Domain Computers';
$this->_options = $options;
$this->_applicationName = 'Admin';
// we might want to add a factory here when we support multiple backends
$this->_backend = new Admin_Backend_SambaMachine($this->_options);
}
示例3: testGetDefaultAdminGroup
/**
* testGetDefaultAdminGroup
*/
public function testGetDefaultAdminGroup()
{
$group = Tinebase_Group::getInstance()->getDefaultAdminGroup();
$expectedGroupName = Tinebase_User::getBackendConfiguration(Tinebase_User::DEFAULT_ADMIN_GROUP_NAME_KEY);
$this->assertEquals($expectedGroupName, $group->name);
}
示例4: 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));
}
示例5: getConfig
/**
* get config for type IMAP/SMTP
*
* @param string $_configType
* @return array
*/
public static function getConfig($_configType)
{
if (!isset(self::$_configs[$_configType])) {
self::$_configs[$_configType] = Tinebase_Config::getInstance()->get($_configType, new Tinebase_Config_Struct())->toArray();
/*
* If LDAP-Url is given (instead of comma separated domains) add secondary domains from LDAP
* e.g. ldap://localhost/ou=domains,ou=mailConfig,dc=example,dc=com?dc?sub?objectclass=mailDomain
*/
if ($_configType == Tinebase_Config::SMTP && array_key_exists('secondarydomains', self::$_configs[Tinebase_Config::SMTP]) && preg_match("~^ldaps?://~i", self::$_configs[Tinebase_Config::SMTP]['secondarydomains'])) {
$ldap_url = parse_url(self::$_configs[Tinebase_Config::SMTP]['secondarydomains']);
$ldap_url['path'] = substr($ldap_url['path'], 1);
$query = explode('?', $ldap_url['query']);
count($query) > 0 ? $ldap_url['attributes'] = explode(',', $query[0]) : ($ldap_url['attributes'] = array());
$ldap_url['scope'] = Zend_Ldap::SEARCH_SCOPE_BASE;
if (count($query) > 1) {
switch ($query[1]) {
case 'subtree':
case 'sub':
$ldap_url['scope'] = Zend_Ldap::SEARCH_SCOPE_SUB;
break;
case 'one':
$ldap_url['scope'] = Zend_Ldap::SEARCH_SCOPE_ONE;
break;
}
}
count($query) > 2 ? $ldap_url['filter'] = $query[2] : ($ldap_url['filter'] = 'objectClass=*');
// By now your options are limited to configured server
$ldap = new Tinebase_Ldap(Tinebase_User::getBackendConfiguration());
$ldap->connect()->bind();
$secondarydomains = $ldap->searchEntries($ldap_url['filter'], $ldap_url['path'], $ldap_url['scope'], $ldap_url['attributes']);
self::$_configs[Tinebase_Config::SMTP]['secondarydomains'] = '';
foreach ($secondarydomains as $dn) {
foreach ($ldap_url['attributes'] as $attr) {
if (array_key_exists($attr, $dn)) {
foreach ($dn[$attr] as $domain) {
self::$_configs[Tinebase_Config::SMTP]['secondarydomains'] != '' ? $domain = ',' . $domain : $domain;
self::$_configs[Tinebase_Config::SMTP]['secondarydomains'] .= $domain;
}
}
}
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Secondarydomains: ' . print_r(self::$_configs[Tinebase_Config::SMTP]['secondarydomains'], true));
}
}
}
return self::$_configs[$_configType];
}
示例6: _getDefaultGroup
/**
* get default group for users/admins
*
* @param string $_name group name (Users|Administrators)
* @return unknown_type
*/
protected function _getDefaultGroup($_name = 'Users')
{
if (!in_array($_name, array('Users', 'Administrators'))) {
throw new Tinebase_Exception_InvalidArgument('Wrong group name: ' . $_name);
}
$configKey = $_name == 'Users' ? Tinebase_User::DEFAULT_USER_GROUP_NAME_KEY : Tinebase_User::DEFAULT_ADMIN_GROUP_NAME_KEY;
$defaultGroupName = Tinebase_User::getBackendConfiguration($configKey);
if (empty($defaultGroupName)) {
Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' ' . $configKey . ' not found. Check your user backend configuration.');
$defaultGroupName = $_name;
}
try {
$result = $this->getGroupByName($defaultGroupName);
} catch (Tinebase_Exception_Record_NotDefined $tenf) {
// create group on the fly
$result = $this->addGroup(new Tinebase_Model_Group(array('name' => $defaultGroupName)));
}
return $result;
}
示例7: update
/**
* update existing group
*
* @param Tinebase_Model_Group $_group
* @return Tinebase_Model_Group
*/
public function update(Tinebase_Model_Group $_group)
{
$this->checkRight('MANAGE_ACCOUNTS');
// update default user group if name has changed
$oldGroup = Tinebase_Group::getInstance()->getGroupById($_group->getId());
$defaultGroupName = Tinebase_User::getBackendConfiguration(Tinebase_User::DEFAULT_USER_GROUP_NAME_KEY);
if ($oldGroup->name == $defaultGroupName && $oldGroup->name != $_group->name) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Updated default group name: ' . $oldGroup->name . ' -> ' . $_group->name);
Tinebase_User::setBackendConfiguration($_group->name, Tinebase_User::DEFAULT_USER_GROUP_NAME_KEY);
Tinebase_User::saveBackendConfiguration();
}
$transactionId = Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
if (Tinebase_Application::getInstance()->isInstalled('Addressbook') === true) {
$_group->list_id = $oldGroup->list_id;
$list = $this->createOrUpdateList($_group);
$_group->list_id = $list->getId();
}
$group = Tinebase_Group::getInstance()->updateGroup($_group);
Tinebase_Group::getInstance()->setGroupMembers($group->getId(), $_group->members);
Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId);
$event = new Admin_Event_UpdateGroup();
$event->group = $group;
Tinebase_Event::fireEvent($event);
return $group;
}
示例8: _getGroupSID
/**
* return sid of group
*
* @param string $_groupId
* @return string the sid of the group
*/
protected function _getGroupSID($_groupId)
{
$ldapOptions = Tinebase_User::getBackendConfiguration();
$filter = Zend_Ldap_Filter::equals($ldapOptions['groupUUIDAttribute'], Zend_Ldap::filterEscape($_groupId));
$groups = $this->_ldap->search($filter, $ldapOptions['groupsDn'], Zend_Ldap::SEARCH_SCOPE_SUB, array('sambasid'));
if (count($groups) == 0) {
throw new Tinebase_Exception_NotFound('Group not found! Filter: ' . $filter->toString());
}
$group = $groups->getFirst();
if (empty($group['sambasid'][0])) {
throw new Tinebase_Exception_NotFound('Group has no sambaSID');
}
return $group['sambasid'][0];
}
示例9: testInstallGroupNameOptions
/**
* testInstallGroupNameOptions
*/
public function testInstallGroupNameOptions()
{
$this->_uninstallAllApplications();
$this->_installAllApplications(array('defaultAdminGroupName' => 'phpunit-admins', 'defaultUserGroupName' => 'phpunit-users', 'adminLoginName' => Tinebase_Core::get('testconfig')->username, 'adminPassword' => Tinebase_Core::get('testconfig')->password));
$adminUser = Tinebase_Core::get('currentAccount');
$this->assertEquals('phpunit-admins', Tinebase_User::getBackendConfiguration(Tinebase_User::DEFAULT_ADMIN_GROUP_NAME_KEY));
$this->assertEquals('phpunit-users', Tinebase_User::getBackendConfiguration(Tinebase_User::DEFAULT_USER_GROUP_NAME_KEY));
//cleanup
$this->_uninstallAllApplications();
}
示例10: __construct
/**
* 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!');
}
}
}
示例11: testInstallGroupNameOptions
/**
* testInstallGroupNameOptions
*/
public function testInstallGroupNameOptions()
{
$this->_uninstallAllApplications();
$testCredentials = Setup_TestServer::getInstance()->getTestCredentials();
$this->_installAllApplications(array('defaultAdminGroupName' => 'phpunit-admins', 'defaultUserGroupName' => 'phpunit-users', 'adminLoginName' => $testCredentials['username'], 'adminPassword' => $testCredentials['password']));
$adminUser = Tinebase_Core::get('currentAccount');
$this->assertEquals('phpunit-admins', Tinebase_User::getBackendConfiguration(Tinebase_User::DEFAULT_ADMIN_GROUP_NAME_KEY));
$this->assertEquals('phpunit-users', Tinebase_User::getBackendConfiguration(Tinebase_User::DEFAULT_USER_GROUP_NAME_KEY));
//cleanup
$this->_uninstallAllApplications();
}