Revert "Introduce option to hide specific customvars in web"
This commit is contained in:
parent
cf36b1f848
commit
da5704fa83
|
@ -61,21 +61,6 @@ class SecurityConfigForm extends ConfigForm
|
|||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'text',
|
||||
'hidden_customvars',
|
||||
array(
|
||||
'allowEmpty' => true,
|
||||
'attribs' => array('placeholder' => $this->getDefaultProtectedCustomvars()),
|
||||
'label' => $this->translate('Hidden Custom Variables'),
|
||||
'description' => $this->translate(
|
||||
'Comma separated case insensitive list of hidden custom variables.'
|
||||
. ' Use * as a placeholder for zero or more wildcard characters.'
|
||||
. ' Existence of those custom variables will not be shown, but remain usable for modules.'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -419,9 +419,7 @@ abstract class MonitoredObject implements Filterable
|
|||
public function fetchCustomvars()
|
||||
{
|
||||
$blacklist = array();
|
||||
$hidden = array();
|
||||
$blacklistPattern = '';
|
||||
$hiddenPattern = '';
|
||||
|
||||
if (($blacklistConfig = Config::module('monitoring')->get('security', 'protected_customvars', '')) !== '') {
|
||||
foreach (explode(',', $blacklistConfig) as $customvar) {
|
||||
|
@ -434,17 +432,6 @@ abstract class MonitoredObject implements Filterable
|
|||
$blacklistPattern = '/^(' . implode('|', $blacklist) . ')$/i';
|
||||
}
|
||||
|
||||
if (($hiddenConfig = Config::module('monitoring')->get('security', 'hidden_customvars', '')) !== '') {
|
||||
foreach (explode(',', $hiddenConfig) as $customvar) {
|
||||
$nonWildcards = array();
|
||||
foreach (explode('*', $customvar) as $nonWildcard) {
|
||||
$nonWildcards[] = preg_quote($nonWildcard, '/');
|
||||
}
|
||||
$hidden[] = implode('.*', $nonWildcards);
|
||||
}
|
||||
$hiddenPattern = '/^(' . implode('|', $hidden) . ')$/i';
|
||||
}
|
||||
|
||||
if ($this->type === self::TYPE_SERVICE) {
|
||||
$this->fetchServiceVariables();
|
||||
$customvars = $this->serviceVariables;
|
||||
|
@ -460,12 +447,6 @@ abstract class MonitoredObject implements Filterable
|
|||
$this->customvars = $this->obfuscateCustomVars($this->customvars, $blacklistPattern);
|
||||
}
|
||||
|
||||
if ($hiddenPattern) {
|
||||
$this->customvars = array_filter($this->customvars, function ($elem) use ($hiddenPattern) {
|
||||
return !($hiddenPattern && preg_match($hiddenPattern, $elem));
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue