RolesController: Rename to RoleController

This commit is contained in:
Johannes Meyer 2015-06-02 11:57:13 +02:00
parent cd0c418854
commit 00c31ffd28
6 changed files with 18 additions and 30 deletions
application
library/Icinga/Web/Controller

View File

@ -7,25 +7,22 @@ use Icinga\Forms\Security\RoleForm;
use Icinga\Web\Controller\AuthBackendController;
use Icinga\Web\Notification;
/**
* Roles configuration
*/
class RolesController extends AuthBackendController
class RoleController extends AuthBackendController
{
/**
* List roles
*/
public function indexAction()
public function listAction()
{
$this->assertPermission('config/authentication/roles/show');
$this->createListTabs()->activate('roles');
$this->createListTabs()->activate('role/list');
$this->view->roles = Config::app('roles', true);
}
/**
* Create a new role
*/
public function newAction()
public function addAction()
{
$this->assertPermission('config/authentication/roles/add');
$role = new RoleForm(array(
@ -49,9 +46,10 @@ class RolesController extends AuthBackendController
->setTitle($this->translate('New Role'))
->setSubmitLabel($this->translate('Create Role'))
->setIniConfig(Config::app('roles', true))
->setRedirectUrl('roles')
->setRedirectUrl('role/list')
->handleRequest();
$this->view->form = $role;
$this->render('form');
}
/**
@ -59,7 +57,7 @@ class RolesController extends AuthBackendController
*
* @throws Zend_Controller_Action_Exception If the required parameter 'role' is missing or the role does not exist
*/
public function updateAction()
public function editAction()
{
$this->assertPermission('config/authentication/roles/edit');
$name = $this->_request->getParam('role');
@ -99,9 +97,10 @@ class RolesController extends AuthBackendController
}
return false;
})
->setRedirectUrl('roles')
->setRedirectUrl('role/list')
->handleRequest();
$this->view->form = $role;
$this->render('form');
}
/**
@ -148,8 +147,9 @@ class RolesController extends AuthBackendController
$confirmation
->setTitle(sprintf($this->translate('Remove Role %s'), $name))
->setSubmitLabel($this->translate('Remove Role'))
->setRedirectUrl('roles')
->setRedirectUrl('role/list')
->handleRequest();
$this->view->form = $confirmation;
$this->render('form');
}
}

View File

@ -1,6 +1,6 @@
<div class="controls">
<?= $tabs->showOnlyCloseButton() ?>
<?= $tabs->showOnlyCloseButton(); ?>
</div>
<div class="content">
<?= $form ?>
<?= $form; ?>
</div>

View File

@ -22,7 +22,7 @@
<td>
<?= $this->qlink(
$name,
'roles/update',
'role/edit',
array('role' => $name),
array('title' => sprintf($this->translate('Edit role %s'), $name))
); ?>
@ -54,7 +54,7 @@
<td>
<?= $this->qlink(
'',
'roles/remove',
'role/remove',
array('role' => $name),
array(
'icon' => 'trash',
@ -67,7 +67,7 @@
</tbody>
</table>
<?php endif ?>
<a data-base-target="_next" href="<?= $this->href('roles/new') ?>">
<a data-base-target="_next" href="<?= $this->href('role/new') ?>">
<?= $this->translate('Create a New Role') ?>
</a>
</div>

View File

@ -1,6 +0,0 @@
<div class="controls">
<?= $tabs->showOnlyCloseButton() ?>
</div>
<div class="content">
<?= $form ?>
</div>

View File

@ -1,6 +0,0 @@
<div class="controls">
<?= $tabs->showOnlyCloseButton() ?>
</div>
<div class="content">
<?= $form ?>
</div>

View File

@ -165,13 +165,13 @@ class AuthBackendController extends Controller
if ($this->hasPermission('config/authentication/roles/show')) {
$tabs->add(
'roles',
'role/list',
array(
'title' => $this->translate(
'Configure roles to permit or restrict users and groups accessing Icinga Web 2'
),
'label' => $this->translate('Roles'),
'url' => 'roles'
'url' => 'role/list'
)
);
}