Merge pull request #4027 from Icinga/revert-3993-feature/hide-customvars
Revert "Introduce option to hide specific customvars in web"
This commit is contained in:
commit
8a959c9f67
|
@ -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()
|
public function fetchCustomvars()
|
||||||
{
|
{
|
||||||
$blacklist = array();
|
$blacklist = array();
|
||||||
$hidden = array();
|
|
||||||
$blacklistPattern = '';
|
$blacklistPattern = '';
|
||||||
$hiddenPattern = '';
|
|
||||||
|
|
||||||
if (($blacklistConfig = Config::module('monitoring')->get('security', 'protected_customvars', '')) !== '') {
|
if (($blacklistConfig = Config::module('monitoring')->get('security', 'protected_customvars', '')) !== '') {
|
||||||
foreach (explode(',', $blacklistConfig) as $customvar) {
|
foreach (explode(',', $blacklistConfig) as $customvar) {
|
||||||
|
@ -434,17 +432,6 @@ abstract class MonitoredObject implements Filterable
|
||||||
$blacklistPattern = '/^(' . implode('|', $blacklist) . ')$/i';
|
$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) {
|
if ($this->type === self::TYPE_SERVICE) {
|
||||||
$this->fetchServiceVariables();
|
$this->fetchServiceVariables();
|
||||||
$customvars = $this->serviceVariables;
|
$customvars = $this->serviceVariables;
|
||||||
|
@ -460,12 +447,6 @@ abstract class MonitoredObject implements Filterable
|
||||||
$this->customvars = $this->obfuscateCustomVars($this->customvars, $blacklistPattern);
|
$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;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue