From 00c31ffd28845babbad674e1cf8c5c2bc5f59920 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 2 Jun 2015 11:57:13 +0200 Subject: [PATCH] RolesController: Rename to RoleController --- ...RolesController.php => RoleController.php} | 22 +++++++++---------- .../{roles/update.phtml => role/form.phtml} | 4 ++-- .../{roles/index.phtml => role/list.phtml} | 6 ++--- application/views/scripts/roles/new.phtml | 6 ----- application/views/scripts/roles/remove.phtml | 6 ----- .../Web/Controller/AuthBackendController.php | 4 ++-- 6 files changed, 18 insertions(+), 30 deletions(-) rename application/controllers/{RolesController.php => RoleController.php} (91%) rename application/views/scripts/{roles/update.phtml => role/form.phtml} (50%) rename application/views/scripts/{roles/index.phtml => role/list.phtml} (95%) delete mode 100644 application/views/scripts/roles/new.phtml delete mode 100644 application/views/scripts/roles/remove.phtml diff --git a/application/controllers/RolesController.php b/application/controllers/RoleController.php similarity index 91% rename from application/controllers/RolesController.php rename to application/controllers/RoleController.php index 57c972f32..0384009ec 100644 --- a/application/controllers/RolesController.php +++ b/application/controllers/RoleController.php @@ -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'); } } diff --git a/application/views/scripts/roles/update.phtml b/application/views/scripts/role/form.phtml similarity index 50% rename from application/views/scripts/roles/update.phtml rename to application/views/scripts/role/form.phtml index ca1e1559e..cbf06590d 100644 --- a/application/views/scripts/roles/update.phtml +++ b/application/views/scripts/role/form.phtml @@ -1,6 +1,6 @@
- showOnlyCloseButton() ?> + showOnlyCloseButton(); ?>
- +
\ No newline at end of file diff --git a/application/views/scripts/roles/index.phtml b/application/views/scripts/role/list.phtml similarity index 95% rename from application/views/scripts/roles/index.phtml rename to application/views/scripts/role/list.phtml index 17e947249..766ba26f3 100644 --- a/application/views/scripts/roles/index.phtml +++ b/application/views/scripts/role/list.phtml @@ -22,7 +22,7 @@ qlink( $name, - 'roles/update', + 'role/edit', array('role' => $name), array('title' => sprintf($this->translate('Edit role %s'), $name)) ); ?> @@ -54,7 +54,7 @@ qlink( '', - 'roles/remove', + 'role/remove', array('role' => $name), array( 'icon' => 'trash', @@ -67,7 +67,7 @@ - + translate('Create a New Role') ?> diff --git a/application/views/scripts/roles/new.phtml b/application/views/scripts/roles/new.phtml deleted file mode 100644 index ca1e1559e..000000000 --- a/application/views/scripts/roles/new.phtml +++ /dev/null @@ -1,6 +0,0 @@ -
- showOnlyCloseButton() ?> -
-
- -
\ No newline at end of file diff --git a/application/views/scripts/roles/remove.phtml b/application/views/scripts/roles/remove.phtml deleted file mode 100644 index ca1e1559e..000000000 --- a/application/views/scripts/roles/remove.phtml +++ /dev/null @@ -1,6 +0,0 @@ -
- showOnlyCloseButton() ?> -
-
- -
\ No newline at end of file diff --git a/library/Icinga/Web/Controller/AuthBackendController.php b/library/Icinga/Web/Controller/AuthBackendController.php index aafa2d703..45b512c8a 100644 --- a/library/Icinga/Web/Controller/AuthBackendController.php +++ b/library/Icinga/Web/Controller/AuthBackendController.php @@ -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' ) ); }