mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 23:04:51 +02:00
parent
0c47aececc
commit
93f7bfeeb9
@ -5,6 +5,7 @@ namespace Icinga\Forms;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use DateTimeZone;
|
use DateTimeZone;
|
||||||
|
use Icinga\Application\Config;
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
use Icinga\Authentication\Auth;
|
use Icinga\Authentication\Auth;
|
||||||
use Icinga\User\Preferences;
|
use Icinga\User\Preferences;
|
||||||
@ -178,6 +179,19 @@ class PreferenceForm extends Form
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (Auth::getInstance()->hasPermission('application/stacktraces')) {
|
||||||
|
$this->addElement(
|
||||||
|
'checkbox',
|
||||||
|
'show_stacktraces',
|
||||||
|
array(
|
||||||
|
'required' => true,
|
||||||
|
'value' => $this->getDefaultShowStacktraces(),
|
||||||
|
'label' => $this->translate('Show Stacktraces'),
|
||||||
|
'description' => $this->translate('Set whether to show an exception\'s stacktrace.')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'checkbox',
|
'checkbox',
|
||||||
'show_benchmark',
|
'show_benchmark',
|
||||||
@ -269,4 +283,14 @@ class PreferenceForm extends Form
|
|||||||
$locale = Translator::getPreferredLocaleCode($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
$locale = Translator::getPreferredLocaleCode($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||||
return $locale;
|
return $locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the default global setting for show_stacktraces
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function getDefaultShowStacktraces()
|
||||||
|
{
|
||||||
|
return Config::app()->get('global', 'show_stacktraces', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,35 +20,7 @@ class RoleForm extends ConfigForm
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $providedPermissions = array(
|
protected $providedPermissions;
|
||||||
'*' => 'Allow everything (*)',
|
|
||||||
'config/*' => 'Allow config access (config/*)',
|
|
||||||
/*
|
|
||||||
// [tg] seems excessive for me, hidden for rc1, tbd
|
|
||||||
'config/application/*' => 'config/application/*',
|
|
||||||
'config/application/general' => 'config/application/general',
|
|
||||||
'config/application/resources' => 'config/application/resources',
|
|
||||||
'config/application/userbackend' => 'config/application/userbackend',
|
|
||||||
'config/application/usergroupbackend' => 'config/application/usergroupbackend',
|
|
||||||
'config/authentication/*' => 'config/authentication/*',
|
|
||||||
'config/authentication/users/*' => 'config/authentication/users/*',
|
|
||||||
'config/authentication/users/show' => 'config/authentication/users/show',
|
|
||||||
'config/authentication/users/add' => 'config/authentication/users/add',
|
|
||||||
'config/authentication/users/edit' => 'config/authentication/users/edit',
|
|
||||||
'config/authentication/users/remove' => 'config/authentication/users/remove',
|
|
||||||
'config/authentication/groups/*' => 'config/authentication/groups/*',
|
|
||||||
'config/authentication/groups/show' => 'config/authentication/groups/show',
|
|
||||||
'config/authentication/groups/add' => 'config/authentication/groups/add',
|
|
||||||
'config/authentication/groups/edit' => 'config/authentication/groups/edit',
|
|
||||||
'config/authentication/groups/remove' => 'config/authentication/groups/remove',
|
|
||||||
'config/authentication/roles/*' => 'config/authentication/roles/*',
|
|
||||||
'config/authentication/roles/show' => 'config/authentication/roles/show',
|
|
||||||
'config/authentication/roles/add' => 'config/authentication/roles/add',
|
|
||||||
'config/authentication/roles/edit' => 'config/authentication/roles/edit',
|
|
||||||
'config/authentication/roles/remove' => 'config/authentication/roles/remove',
|
|
||||||
'config/modules' => 'config/modules'
|
|
||||||
*/
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provided restrictions by currently loaded modules
|
* Provided restrictions by currently loaded modules
|
||||||
@ -62,6 +34,40 @@ class RoleForm extends ConfigForm
|
|||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
$this->providedPermissions = array(
|
||||||
|
'*' => $this->translate('Allow everything') . ' (*)',
|
||||||
|
'application/stacktraces' => $this->translate(
|
||||||
|
'Allow to adjust in the preferences whether to show stacktraces'
|
||||||
|
) . ' (application/stacktraces)',
|
||||||
|
'config/*' => $this->translate('Allow config access') . ' (config/*)',
|
||||||
|
/*
|
||||||
|
// [tg] seems excessive for me, hidden for rc1, tbd
|
||||||
|
'config/application/*' => 'config/application/*',
|
||||||
|
'config/application/general' => 'config/application/general',
|
||||||
|
'config/application/resources' => 'config/application/resources',
|
||||||
|
'config/application/userbackend' => 'config/application/userbackend',
|
||||||
|
'config/application/usergroupbackend' => 'config/application/usergroupbackend',
|
||||||
|
'config/authentication/*' => 'config/authentication/*',
|
||||||
|
'config/authentication/users/*' => 'config/authentication/users/*',
|
||||||
|
'config/authentication/users/show' => 'config/authentication/users/show',
|
||||||
|
'config/authentication/users/add' => 'config/authentication/users/add',
|
||||||
|
'config/authentication/users/edit' => 'config/authentication/users/edit',
|
||||||
|
'config/authentication/users/remove' => 'config/authentication/users/remove',
|
||||||
|
'config/authentication/groups/*' => 'config/authentication/groups/*',
|
||||||
|
'config/authentication/groups/show' => 'config/authentication/groups/show',
|
||||||
|
'config/authentication/groups/add' => 'config/authentication/groups/add',
|
||||||
|
'config/authentication/groups/edit' => 'config/authentication/groups/edit',
|
||||||
|
'config/authentication/groups/remove' => 'config/authentication/groups/remove',
|
||||||
|
'config/authentication/roles/*' => 'config/authentication/roles/*',
|
||||||
|
'config/authentication/roles/show' => 'config/authentication/roles/show',
|
||||||
|
'config/authentication/roles/add' => 'config/authentication/roles/add',
|
||||||
|
'config/authentication/roles/edit' => 'config/authentication/roles/edit',
|
||||||
|
'config/authentication/roles/remove' => 'config/authentication/roles/remove',
|
||||||
|
'config/modules' => 'config/modules'
|
||||||
|
*/
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$helper = new Zend_Form_Element('bogus');
|
$helper = new Zend_Form_Element('bogus');
|
||||||
$mm = Icinga::app()->getModuleManager();
|
$mm = Icinga::app()->getModuleManager();
|
||||||
foreach ($mm->listInstalledModules() as $moduleName) {
|
foreach ($mm->listInstalledModules() as $moduleName) {
|
||||||
|
@ -214,6 +214,13 @@ class Web extends EmbeddedWeb
|
|||||||
$this->frontController->setControllerDirectory($this->getApplicationDir('/controllers'));
|
$this->frontController->setControllerDirectory($this->getApplicationDir('/controllers'));
|
||||||
|
|
||||||
$displayExceptions = $this->config->get('global', 'show_stacktraces', true);
|
$displayExceptions = $this->config->get('global', 'show_stacktraces', true);
|
||||||
|
if ($this->user !== null && $this->user->can('application/stacktraces')) {
|
||||||
|
$displayExceptions = $this->user->getPreferences()->getValue(
|
||||||
|
'icingaweb',
|
||||||
|
'show_stacktraces',
|
||||||
|
$displayExceptions
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$this->frontController->setParams(
|
$this->frontController->setParams(
|
||||||
array(
|
array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user