mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 14:54:24 +02:00
Merge branch 'bugfix/move-auth-backend-configuration-to-app-config-10309'
fixes #10309
This commit is contained in:
commit
88f4f68f29
@ -45,27 +45,12 @@ class ConfigController extends Controller
|
|||||||
'url' => 'config/resource',
|
'url' => 'config/resource',
|
||||||
'baseTarget' => '_main'
|
'baseTarget' => '_main'
|
||||||
));
|
));
|
||||||
return $tabs;
|
$tabs->add('authentication', array(
|
||||||
}
|
'title' => $this->translate('Configure the user and group backends'),
|
||||||
|
'label' => $this->translate('Authentication'),
|
||||||
/**
|
|
||||||
* Create and return the tabs to display when showing authentication configuration
|
|
||||||
*/
|
|
||||||
public function createAuthenticationTabs()
|
|
||||||
{
|
|
||||||
$tabs = $this->getTabs();
|
|
||||||
$tabs->add('userbackend', array(
|
|
||||||
'title' => $this->translate('Configure how users authenticate with and log into Icinga Web 2'),
|
|
||||||
'label' => $this->translate('Users'),
|
|
||||||
'url' => 'config/userbackend',
|
'url' => 'config/userbackend',
|
||||||
'baseTarget' => '_main'
|
'baseTarget' => '_main'
|
||||||
));
|
));
|
||||||
$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',
|
|
||||||
'baseTarget' => '_main'
|
|
||||||
));
|
|
||||||
return $tabs;
|
return $tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,17 +169,19 @@ class ConfigController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action for listing and reordering user backends
|
* Action for listing user and group backends
|
||||||
*/
|
*/
|
||||||
public function userbackendAction()
|
public function userbackendAction()
|
||||||
{
|
{
|
||||||
$this->assertPermission('config/application/userbackend');
|
$this->assertPermission('config/application/userbackend');
|
||||||
|
$this->assertPermission('config/application/usergroupbackend');
|
||||||
$form = new UserBackendReorderForm();
|
$form = new UserBackendReorderForm();
|
||||||
$form->setIniConfig(Config::app('authentication'));
|
$form->setIniConfig(Config::app('authentication'));
|
||||||
$form->handleRequest();
|
$form->handleRequest();
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->createAuthenticationTabs()->activate('userbackend');
|
$this->view->backendNames = Config::app('groups');
|
||||||
|
$this->createApplicationTabs()->activate('authentication');
|
||||||
$this->render('userbackend/reorder');
|
$this->render('userbackend/reorder');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,16 +29,7 @@ class UsergroupbackendController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$this->redirectNow('usergroupbackend/list');
|
$this->redirectNow('config/userbackend');
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show a list of all user group backends
|
|
||||||
*/
|
|
||||||
public function listAction()
|
|
||||||
{
|
|
||||||
$this->view->backendNames = Config::app('groups');
|
|
||||||
$this->createListTabs()->activate('usergroupbackend');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,7 +38,7 @@ class UsergroupbackendController extends Controller
|
|||||||
public function createAction()
|
public function createAction()
|
||||||
{
|
{
|
||||||
$form = new UserGroupBackendForm();
|
$form = new UserGroupBackendForm();
|
||||||
$form->setRedirectUrl('usergroupbackend/list');
|
$form->setRedirectUrl('config/userbackend');
|
||||||
$form->addDescription($this->translate('Create a new backend to associate users and groups with.'));
|
$form->addDescription($this->translate('Create a new backend to associate users and groups with.'));
|
||||||
$form->setIniConfig(Config::app('groups'));
|
$form->setIniConfig(Config::app('groups'));
|
||||||
$form->setOnSuccess(function (UserGroupBackendForm $form) {
|
$form->setOnSuccess(function (UserGroupBackendForm $form) {
|
||||||
@ -78,7 +69,7 @@ class UsergroupbackendController extends Controller
|
|||||||
$backendName = $this->params->getRequired('backend');
|
$backendName = $this->params->getRequired('backend');
|
||||||
|
|
||||||
$form = new UserGroupBackendForm();
|
$form = new UserGroupBackendForm();
|
||||||
$form->setRedirectUrl('usergroupbackend/list');
|
$form->setRedirectUrl('config/userbackend');
|
||||||
$form->setIniConfig(Config::app('groups'));
|
$form->setIniConfig(Config::app('groups'));
|
||||||
$form->setOnSuccess(function (UserGroupBackendForm $form) use ($backendName) {
|
$form->setOnSuccess(function (UserGroupBackendForm $form) use ($backendName) {
|
||||||
try {
|
try {
|
||||||
@ -121,7 +112,7 @@ class UsergroupbackendController extends Controller
|
|||||||
$backendForm = new UserGroupBackendForm();
|
$backendForm = new UserGroupBackendForm();
|
||||||
$backendForm->setIniConfig(Config::app('groups'));
|
$backendForm->setIniConfig(Config::app('groups'));
|
||||||
$form = new ConfirmRemovalForm();
|
$form = new ConfirmRemovalForm();
|
||||||
$form->setRedirectUrl('usergroupbackend/list');
|
$form->setRedirectUrl('config/userbackend');
|
||||||
$form->setOnSuccess(function (ConfirmRemovalForm $form) use ($backendName, $backendForm) {
|
$form->setOnSuccess(function (ConfirmRemovalForm $form) use ($backendName, $backendForm) {
|
||||||
try {
|
try {
|
||||||
$backendForm->delete($backendName);
|
$backendForm->delete($backendName);
|
||||||
@ -141,23 +132,4 @@ class UsergroupbackendController extends Controller
|
|||||||
|
|
||||||
$this->renderForm($form, $this->translate('Remove User Group Backend'));
|
$this->renderForm($form, $this->translate('Remove User Group Backend'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the tabs for the application configuration
|
|
||||||
*/
|
|
||||||
protected function createListTabs()
|
|
||||||
{
|
|
||||||
$tabs = $this->getTabs();
|
|
||||||
$tabs->add('userbackend', array(
|
|
||||||
'title' => $this->translate('Configure how users authenticate with and log into Icinga Web 2'),
|
|
||||||
'label' => $this->translate('Users'),
|
|
||||||
'url' => 'config/userbackend'
|
|
||||||
));
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<?= $tabs ?>
|
<?= $tabs ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
<h1><?= $this->translate('User Backends') ?></h1>
|
||||||
<?= $this->qlink(
|
<?= $this->qlink(
|
||||||
$this->translate('Create a New User Backend') ,
|
$this->translate('Create a New User Backend') ,
|
||||||
'config/createuserbackend',
|
'config/createuserbackend',
|
||||||
@ -14,4 +15,57 @@
|
|||||||
)
|
)
|
||||||
) ?>
|
) ?>
|
||||||
<?= $form ?>
|
<?= $form ?>
|
||||||
|
|
||||||
|
<h1><?= $this->translate('User Group Backends') ?></h1>
|
||||||
|
<?= $this->qlink(
|
||||||
|
$this->translate('Create a New User Group Backend') ,
|
||||||
|
'usergroupbackend/create',
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'class' => 'button-link',
|
||||||
|
'data-base-target' => '_next',
|
||||||
|
'icon' => 'plus',
|
||||||
|
'title' => $this->translate('Create a new user group backend')
|
||||||
|
)
|
||||||
|
) ?>
|
||||||
|
<?php if (! count($backendNames)) { return; } ?>
|
||||||
|
<table class="table-row-selectable common-table" data-base-target="_next">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?= $this->translate('Backend') ?></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($backendNames as $backendName => $config):
|
||||||
|
$type = $config->get('backend');
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?= $this->qlink(
|
||||||
|
$backendName,
|
||||||
|
'usergroupbackend/edit',
|
||||||
|
array('backend' => $backendName),
|
||||||
|
array(
|
||||||
|
'icon' => $type === 'external' ? 'magic' : ($type === 'ldap' || $type === 'msldap' ? 'sitemap' : 'database'),
|
||||||
|
'title' => sprintf($this->translate('Edit user group backend %s'), $backendName)
|
||||||
|
)
|
||||||
|
); ?>
|
||||||
|
</td>
|
||||||
|
<td class="icon-col text-right">
|
||||||
|
<?= $this->qlink(
|
||||||
|
null,
|
||||||
|
'usergroupbackend/remove',
|
||||||
|
array('backend' => $backendName),
|
||||||
|
array(
|
||||||
|
'class' => 'action-link',
|
||||||
|
'icon' => 'cancel',
|
||||||
|
'title' => sprintf($this->translate('Remove user group backend %s'), $backendName)
|
||||||
|
)
|
||||||
|
) ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
<div class="controls">
|
|
||||||
<?= $tabs ?>
|
|
||||||
</div>
|
|
||||||
<div class="content">
|
|
||||||
<?= $this->qlink(
|
|
||||||
$this->translate('Create a New User Group Backend') ,
|
|
||||||
'usergroupbackend/create',
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'class' => 'button-link',
|
|
||||||
'data-base-target' => '_next',
|
|
||||||
'icon' => 'plus',
|
|
||||||
'title' => $this->translate('Create a new user group backend')
|
|
||||||
)
|
|
||||||
) ?>
|
|
||||||
<?php if (! count($backendNames)) { return; } ?>
|
|
||||||
<table class="table-row-selectable common-table" data-base-target="_next">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><?= $this->translate('Backend') ?></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($backendNames as $backendName => $config):
|
|
||||||
$type = $config->get('backend');
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<?= $this->qlink(
|
|
||||||
$backendName,
|
|
||||||
'usergroupbackend/edit',
|
|
||||||
array('backend' => $backendName),
|
|
||||||
array(
|
|
||||||
'icon' => $type === 'external' ? 'magic' : ($type === 'ldap' || $type === 'msldap' ? 'sitemap' : 'database'),
|
|
||||||
'title' => sprintf($this->translate('Edit user group backend %s'), $backendName)
|
|
||||||
)
|
|
||||||
); ?>
|
|
||||||
</td>
|
|
||||||
<td class="icon-col text-right">
|
|
||||||
<?= $this->qlink(
|
|
||||||
null,
|
|
||||||
'usergroupbackend/remove',
|
|
||||||
array('backend' => $backendName),
|
|
||||||
array(
|
|
||||||
'class' => 'action-link',
|
|
||||||
'icon' => 'cancel',
|
|
||||||
'title' => sprintf($this->translate('Remove user group backend %s'), $backendName)
|
|
||||||
)
|
|
||||||
) ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
@ -321,13 +321,7 @@ class Web extends EmbeddedWeb
|
|||||||
'priority' => 810
|
'priority' => 810
|
||||||
),
|
),
|
||||||
'authentication' => array(
|
'authentication' => array(
|
||||||
'label' => t('Authentication'),
|
'label' => t('Authentication'),
|
||||||
'url' => 'config/userbackend',
|
|
||||||
'permission' => 'config/application/*',
|
|
||||||
'priority' => 820
|
|
||||||
),
|
|
||||||
'authorization' => array(
|
|
||||||
'label' => t('Authorization'),
|
|
||||||
'permission' => 'config/authentication/*',
|
'permission' => 'config/authentication/*',
|
||||||
'priority' => 830,
|
'priority' => 830,
|
||||||
'url' => 'role/list'
|
'url' => 'role/list'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user