summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-09-25 14:05:04 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-09-25 14:05:04 +0200
commit787c668b39f51f0ffe5741d980eaf3472155abff (patch)
tree17a49a3b4ac03273113eaec61eda571ce1a5b028 /core
parent68bf4440d327e5eea71bcbf282640e3c115ec59c (diff)
parentab69a226065d576120d629f857464633fb5d17d9 (diff)
downloadnextcloud-server-787c668b39f51f0ffe5741d980eaf3472155abff.tar.gz
nextcloud-server-787c668b39f51f0ffe5741d980eaf3472155abff.zip
Merge pull request #19360 from owncloud/move-filter-method-into-config-object
Move the filtering of sensitive data to the config class
Diffstat (limited to 'core')
-rw-r--r--core/command/config/listconfigs.php43
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;
- }
}