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

View File

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

View File

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

View File

@ -22,7 +22,7 @@
<td> <td>
<?= $this->qlink( <?= $this->qlink(
$name, $name,
'roles/update', 'role/edit',
array('role' => $name), array('role' => $name),
array('title' => sprintf($this->translate('Edit role %s'), $name)) array('title' => sprintf($this->translate('Edit role %s'), $name))
); ?> ); ?>
@ -54,7 +54,7 @@
<td> <td>
<?= $this->qlink( <?= $this->qlink(
'', '',
'roles/remove', 'role/remove',
array('role' => $name), array('role' => $name),
array( array(
'icon' => 'trash', 'icon' => 'trash',
@ -67,7 +67,7 @@
</tbody> </tbody>
</table> </table>
<?php endif ?> <?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') ?> <?= $this->translate('Create a New Role') ?>
</a> </a>
</div> </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')) { if ($this->hasPermission('config/authentication/roles/show')) {
$tabs->add( $tabs->add(
'roles', 'role/list',
array( array(
'title' => $this->translate( 'title' => $this->translate(
'Configure roles to permit or restrict users and groups accessing Icinga Web 2' 'Configure roles to permit or restrict users and groups accessing Icinga Web 2'
), ),
'label' => $this->translate('Roles'), 'label' => $this->translate('Roles'),
'url' => 'roles' 'url' => 'role/list'
) )
); );
} }