Blame view

sources/apps/user_ldap/appinfo/update.php 1.7 KB
03e52840d   Kload   Init
1
  <?php
03e52840d   Kload   Init
2
3
4
  //detect if we can switch on naming guidelines. We won't do it on conflicts.
  //it's a bit spaghetti, but hey.
  $state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'unset');
31b7f2792   Kload   Upgrade to ownclo...
5
  if($state === 'unset') {
03e52840d   Kload   Init
6
7
  	OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
  }
6d9380f96   Cédric Dupont   Update sources OC...
8
9
  $installedVersion = OCP\Config::getAppValue('user_ldap', 'installed_version');
  $enableRawMode = version_compare($installedVersion, '0.4.1', '<');
31b7f2792   Kload   Upgrade to ownclo...
10
11
12
13
  $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);
31b7f2792   Kload   Upgrade to ownclo...
14

6d9380f96   Cédric Dupont   Update sources OC...
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  	$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);
  	}
03e52840d   Kload   Init
42
  }