diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-09-25 11:08:33 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-09-25 11:08:33 +0200 |
commit | faba02564a24187e69ebe274078793d66fd1a2a2 (patch) | |
tree | 204c7294e0a1a61e54c01e233a70e1f922967d48 /core | |
parent | bf73665a35470432ae939a70eb91ecf9f8933240 (diff) | |
download | nextcloud-server-faba02564a24187e69ebe274078793d66fd1a2a2.tar.gz nextcloud-server-faba02564a24187e69ebe274078793d66fd1a2a2.zip |
Move the filtering of sensitive data to the config class
Diffstat (limited to 'core')
-rw-r--r-- | core/command/config/listconfigs.php | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/core/command/config/listconfigs.php b/core/command/config/listconfigs.php index 5796362f2fc..37aeb53c6f5 100644 --- a/core/command/config/listconfigs.php +++ b/core/command/config/listconfigs.php @@ -32,20 +32,6 @@ use Symfony\Component\Console\Output\OutputInterface; class ListConfigs extends Base { protected $defaultOutputFormat = self::OUTPUT_FORMAT_JSON_PRETTY; - /** @var array */ - protected $sensitiveValues = [ - 'dbpassword' => true, - 'dbuser' => true, - 'mail_smtpname' => true, - 'mail_smtppassword' => true, - 'passwordsalt' => true, - 'secret' => true, - 'ldap_agent_password' => true, - 'objectstore' => ['arguments' => ['password' => true]], - ]; - - const SENSITIVE_VALUE = '***REMOVED SENSITIVE VALUE***'; - /** * @var SystemConfig */ protected $systemConfig; @@ -127,10 +113,10 @@ class ListConfigs extends Base { $configs = []; foreach ($keys as $key) { - $value = $this->systemConfig->getValue($key, serialize(null)); - - if ($noSensitiveValues && isset($this->sensitiveValues[$key])) { - $value = $this->removeSensitiveValue($this->sensitiveValues[$key], $value); + if ($noSensitiveValues) { + $value = $this->systemConfig->getFilteredValue($key, serialize(null)); + } else { + $value = $this->systemConfig->getValue($key, serialize(null)); } if ($value !== 'N;') { @@ -140,25 +126,4 @@ class ListConfigs extends Base { return $configs; } - - /** - * @param bool|array $keysToRemove - * @param mixed $value - * @return mixed - */ - protected function removeSensitiveValue($keysToRemove, $value) { - if ($keysToRemove === true) { - return self::SENSITIVE_VALUE; - } - - if (is_array($value)) { - foreach ($keysToRemove as $keyToRemove => $valueToRemove) { - if (isset($value[$keyToRemove])) { - $value[$keyToRemove] = $this->removeSensitiveValue($valueToRemove, $value[$keyToRemove]); - } - } - } - - return $value; - } } |