|
|
@ -37,9 +37,13 @@ namespace OCA\User_LDAP; |
|
|
|
* @property int ldapPagingSize holds an integer |
|
|
|
* @property int ldapPagingSize holds an integer |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class Configuration { |
|
|
|
class Configuration { |
|
|
|
|
|
|
|
|
|
|
|
protected $configPrefix = null; |
|
|
|
protected $configPrefix = null; |
|
|
|
protected $configRead = false; |
|
|
|
protected $configRead = false; |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @var string[] pre-filled with one reference key so that at least one entry is written on save request and |
|
|
|
|
|
|
|
* the config ID is registered |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected $unsavedChanges = ['ldapConfigurationActive' => 'ldapConfigurationActive']; |
|
|
|
|
|
|
|
|
|
|
|
//settings |
|
|
|
//settings |
|
|
|
protected $config = array( |
|
|
|
protected $config = array( |
|
|
@ -187,7 +191,9 @@ class Configuration { |
|
|
|
$this->$setMethod($key, $val); |
|
|
|
$this->$setMethod($key, $val); |
|
|
|
if(is_array($applied)) { |
|
|
|
if(is_array($applied)) { |
|
|
|
$applied[] = $inputKey; |
|
|
|
$applied[] = $inputKey; |
|
|
|
|
|
|
|
// storing key as index avoids duplication, and as value for simplicity |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$this->unsavedChanges[$key] = $key; |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -240,11 +246,12 @@ class Configuration { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* saves the current Configuration in the database |
|
|
|
* saves the current config changes in the database |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function saveConfiguration() { |
|
|
|
public function saveConfiguration() { |
|
|
|
$cta = array_flip($this->getConfigTranslationArray()); |
|
|
|
$cta = array_flip($this->getConfigTranslationArray()); |
|
|
|
foreach($this->config as $key => $value) { |
|
|
|
foreach($this->unsavedChanges as $key) { |
|
|
|
|
|
|
|
$value = $this->config[$key]; |
|
|
|
switch ($key) { |
|
|
|
switch ($key) { |
|
|
|
case 'ldapAgentPassword': |
|
|
|
case 'ldapAgentPassword': |
|
|
|
$value = base64_encode($value); |
|
|
|
$value = base64_encode($value); |
|
|
@ -275,6 +282,7 @@ class Configuration { |
|
|
|
} |
|
|
|
} |
|
|
|
$this->saveValue($cta[$key], $value); |
|
|
|
$this->saveValue($cta[$key], $value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$this->unsavedChanges = []; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|