ConfigController: Add tab for the user group backend configuration

refs #8826
This commit is contained in:
Johannes Meyer 2015-06-02 10:23:40 +02:00
parent 2490d0ae67
commit ae30a62055
3 changed files with 53 additions and 19 deletions

View File

@ -46,6 +46,14 @@ class ConfigController extends Controller
));
$allowedActions[] = 'general';
}
if ($auth->hasPermission('config/application/resources')) {
$tabs->add('resource', array(
'title' => $this->translate('Configure which resources are being utilized by Icinga Web 2'),
'label' => $this->translate('Resources'),
'url' => 'config/resource'
));
$allowedActions[] = 'resource';
}
if ($auth->hasPermission('config/application/userbackend')) {
$tabs->add('userbackend', array(
'title' => $this->translate('Configure how users authenticate with and log into Icinga Web 2'),
@ -54,13 +62,13 @@ class ConfigController extends Controller
));
$allowedActions[] = 'userbackend';
}
if ($auth->hasPermission('config/application/resources')) {
$tabs->add('resource', array(
'title' => $this->translate('Configure which resources are being utilized by Icinga Web 2'),
'label' => $this->translate('Resources'),
'url' => 'config/resource'
if ($auth->hasPermission('config/application/usergroupbackend')) {
$tabs->add('usergroupbackend', array(
'title' => $this->translate('Configure how users are associated with groups by Icinga Web 2'),
'label' => $this->translate('User Groups'),
'url' => 'usergroupbackend/list'
));
$allowedActions[] = 'resource';
$allowedActions[] = 'usergroupbackend';
}
$this->firstAllowedAction = array_shift($allowedActions);
}

View File

@ -37,14 +37,7 @@ class UsergroupbackendController extends Controller
public function listAction()
{
$this->view->backendNames = Config::app('groups')->keys();
$this->getTabs()->add(
'usergroupbackend/list',
array(
'title' => $this->translate('List all user group backends'),
'label' => $this->translate('User group backends'),
'url' => 'usergroupbackend/list'
)
)->activate('usergroupbackend/list');
$this->createListTabs()->activate('usergroupbackend');
}
/**
@ -149,4 +142,42 @@ class UsergroupbackendController extends Controller
$this->view->form = $form;
$this->render('form');
}
/**
* Create the tabs for the application configuration
*/
protected function createListTabs()
{
$tabs = $this->getTabs();
if ($this->hasPermission('config/application/general')) {
$tabs->add('general', array(
'title' => $this->translate('Adjust the general configuration of Icinga Web 2'),
'label' => $this->translate('General'),
'url' => 'config/general'
));
}
if ($this->hasPermission('config/application/resources')) {
$tabs->add('resource', array(
'title' => $this->translate('Configure which resources are being utilized by Icinga Web 2'),
'label' => $this->translate('Resources'),
'url' => 'config/resource'
));
}
if ($this->hasPermission('config/application/userbackend')) {
$tabs->add('userbackend', array(
'title' => $this->translate('Configure how users authenticate with and log into Icinga Web 2'),
'label' => $this->translate('Authentication'),
'url' => 'config/userbackend'
));
}
if ($this->hasPermission('config/application/usergroupbackend')) {
$tabs->add('usergroupbackend', array(
'title' => $this->translate('Configure how users are associated with groups by Icinga Web 2'),
'label' => $this->translate('User Groups'),
'url' => 'usergroupbackend/list'
));
}
return $tabs;
}
}

View File

@ -259,11 +259,6 @@ class Menu implements RecursiveIterator
'permission' => 'config/authentication/*',
'priority' => 820
));
$section->add(t('UserGroupBackends'), array(
'url' => 'usergroupbackend/list',
'permission' => 'config/application/usergroupbackend',
'priority' => 830
));
$section->add(t('Modules'), array(
'url' => 'config/modules',
'permission' => 'config/modules',