summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/appinfo/update.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2014-05-13 17:47:00 +0200
committerArthur Schiwon <blizzz@owncloud.com>2014-06-02 12:08:01 +0200
commitf0e69b2b99174c29859729c0d91d8b4a97c6f28b (patch)
tree6a28a51576c2c8a7692ca3ec9c2f87e45fae18fe /apps/user_ldap/appinfo/update.php
parentf931df2dac6466568ffdc52bed01d3f781430f9e (diff)
downloadnextcloud-server-f0e69b2b99174c29859729c0d91d8b4a97c6f28b.tar.gz
nextcloud-server-f0e69b2b99174c29859729c0d91d8b4a97c6f28b.zip
Port LDAP: fix filter can be reset and broken after upgrade from OC 5 #8579
LDAP: set filter mode to raw, so filters will not be changed and broken after upgrade from oc5, when visiting the LDAP settings and opening filter tabs get the correct version number for compare -.- bump version and don't overwrite values on next update if not necessary simpler and better readable assignment
Diffstat (limited to 'apps/user_ldap/appinfo/update.php')
-rw-r--r--apps/user_ldap/appinfo/update.php42
1 files changed, 30 insertions, 12 deletions
diff --git a/apps/user_ldap/appinfo/update.php b/apps/user_ldap/appinfo/update.php
index 41770cf97b1..1e706ce869b 100644
--- a/apps/user_ldap/appinfo/update.php
+++ b/apps/user_ldap/appinfo/update.php
@@ -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);
+ }
}