Merge pull request #8579 from owncloud/ldap_nail_filter_on_upgrade

LDAP: fix filter can be reset and broken after upgrade from OC 5
remotes/origin/stable6
blizzz 12 years ago
commit 58b6b89ec4
  1. 42
      apps/user_ldap/appinfo/update.php
  2. 2
      apps/user_ldap/appinfo/version

@ -7,21 +7,39 @@ if($state === 'unset') {
OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
}
$installedVersion = OCP\Config::getAppValue('user_ldap', 'installed_version');
$enableRawMode = version_compare($installedVersion, '0.4.1', '<');
$configPrefixes = OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes(true);
$ldap = new OCA\user_ldap\lib\LDAP();
foreach($configPrefixes as $config) {
$connection = new OCA\user_ldap\lib\Connection($ldap, $config);
$value = \OCP\Config::getAppValue('user_ldap',
$config.'ldap_uuid_attribute', 'auto');
\OCP\Config::setAppValue('user_ldap',
$config.'ldap_uuid_user_attribute', $value);
\OCP\Config::setAppValue('user_ldap',
$config.'ldap_uuid_group_attribute', $value);
$value = \OCP\Config::getAppValue('user_ldap',
$config.'ldap_expert_uuid_attr', 'auto');
\OCP\Config::setAppValue('user_ldap',
$config.'ldap_expert_uuid_user_attr', $value);
\OCP\Config::setAppValue('user_ldap',
$config.'ldap_expert_uuid_group_attr', $value);
$state = \OCP\Config::getAppValue(
'user_ldap', $config.'ldap_uuid_user_attribute', 'not existing');
if($state === 'non existing') {
$value = \OCP\Config::getAppValue(
'user_ldap', $config.'ldap_uuid_attribute', 'auto');
\OCP\Config::setAppValue(
'user_ldap', $config.'ldap_uuid_user_attribute', $value);
\OCP\Config::setAppValue(
'user_ldap', $config.'ldap_uuid_group_attribute', $value);
}
$state = \OCP\Config::getAppValue(
'user_ldap', $config.'ldap_expert_uuid_user_attr', 'not existing');
if($state === 'non existing') {
$value = \OCP\Config::getAppValue(
'user_ldap', $config.'ldap_expert_uuid_attr', 'auto');
\OCP\Config::setAppValue(
'user_ldap', $config.'ldap_expert_uuid_user_attr', $value);
\OCP\Config::setAppValue(
'user_ldap', $config.'ldap_expert_uuid_group_attr', $value);
}
if($enableRawMode) {
\OCP\Config::setAppValue('user_ldap', $config.'ldap_user_filter_mode', 1);
\OCP\Config::setAppValue('user_ldap', $config.'ldap_login_filter_mode', 1);
\OCP\Config::setAppValue('user_ldap', $config.'ldap_group_filter_mode', 1);
}
}

Loading…
Cancel
Save