From 601753a76b662999fa21f5d2bed040c0c078dfce Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 14 Nov 2025 14:41:05 +0100 Subject: [PATCH] Drop `user`, `users`, `usergroup` and `usergroups` endpoints --- application/controllers/UserController.php | 28 ------------------- .../controllers/UsergroupController.php | 28 ------------------- .../controllers/UsergroupsController.php | 28 ------------------- application/controllers/UsersController.php | 28 ------------------- configuration.php | 20 +++---------- doc/05-Upgrading.md | 4 +++ library/Icingadb/Common/Auth.php | 6 ---- 7 files changed, 8 insertions(+), 134 deletions(-) delete mode 100644 application/controllers/UserController.php delete mode 100644 application/controllers/UsergroupController.php delete mode 100644 application/controllers/UsergroupsController.php delete mode 100644 application/controllers/UsersController.php diff --git a/application/controllers/UserController.php b/application/controllers/UserController.php deleted file mode 100644 index 6d64f844..00000000 --- a/application/controllers/UserController.php +++ /dev/null @@ -1,28 +0,0 @@ -getRequest()->getUrl(); - $url->setPath(preg_replace( - '~^icingadb/user(?=/|$)~', - 'icingadb/contact', - $url->getPath() - )); - - $this->getResponse() - ->setHttpResponseCode(301) - ->setHeader('Location', $url->getAbsoluteUrl()) - ->sendResponse(); - } -} diff --git a/application/controllers/UsergroupController.php b/application/controllers/UsergroupController.php deleted file mode 100644 index c3546415..00000000 --- a/application/controllers/UsergroupController.php +++ /dev/null @@ -1,28 +0,0 @@ -getRequest()->getUrl(); - $url->setPath(preg_replace( - '~^icingadb/usergroup(?=/|$)~', - 'icingadb/contactgroup', - $url->getPath() - )); - - $this->getResponse() - ->setHttpResponseCode(301) - ->setHeader('Location', $url->getAbsoluteUrl()) - ->sendResponse(); - } -} diff --git a/application/controllers/UsergroupsController.php b/application/controllers/UsergroupsController.php deleted file mode 100644 index 306a69f7..00000000 --- a/application/controllers/UsergroupsController.php +++ /dev/null @@ -1,28 +0,0 @@ -getRequest()->getUrl(); - $url->setPath(preg_replace( - '~^icingadb/usergroups(?=/|$)~', - 'icingadb/contactgroups', - $url->getPath() - )); - - $this->getResponse() - ->setHttpResponseCode(301) - ->setHeader('Location', $url->getAbsoluteUrl()) - ->sendResponse(); - } -} diff --git a/application/controllers/UsersController.php b/application/controllers/UsersController.php deleted file mode 100644 index 293007f8..00000000 --- a/application/controllers/UsersController.php +++ /dev/null @@ -1,28 +0,0 @@ -getRequest()->getUrl(); - $url->setPath(preg_replace( - '~^icingadb/users(?=/|$)~', - 'icingadb/contacts', - $url->getPath() - )); - - $this->getResponse() - ->setHttpResponseCode(301) - ->setHeader('Location', $url->getAbsoluteUrl()) - ->sendResponse(); - } -} diff --git a/configuration.php b/configuration.php index 43a625c1..e641810c 100644 --- a/configuration.php +++ b/configuration.php @@ -373,10 +373,7 @@ namespace Icinga\Module\Icingadb { ]); } - if ( - ! array_key_exists('usergroups', $routeDenylist) // TODO: Remove with 1.3, compat only - && ! array_key_exists('contactgroups', $routeDenylist) - ) { + if (! array_key_exists('contactgroups', $routeDenylist)) { $overviewSection->add(N_('Contact Groups'), [ 'description' => $this->translate('List contact groups'), 'url' => 'icingadb/contactgroups', @@ -385,10 +382,7 @@ namespace Icinga\Module\Icingadb { ]); } - if ( - ! array_key_exists('users', $routeDenylist) // TODO: Remove with 1.3, compat only - && ! array_key_exists('contacts', $routeDenylist) - ) { + if (! array_key_exists('contacts', $routeDenylist)) { $overviewSection->add(N_('Contacts'), [ 'description' => $this->translate('List contacts'), 'url' => 'icingadb/contacts', @@ -505,10 +499,7 @@ namespace Icinga\Module\Icingadb { ]); } - if ( - ! array_key_exists('usergroups', $routeDenylist) // TODO: Remove with 1.3, compat only - && ! array_key_exists('contactgroups', $routeDenylist) - ) { + if (! array_key_exists('contactgroups', $routeDenylist)) { $section->add(N_('Contact Groups'), [ 'url' => 'icingadb/contactgroups', 'priority' => 70, @@ -517,10 +508,7 @@ namespace Icinga\Module\Icingadb { ]); } - if ( - ! array_key_exists('users', $routeDenylist) // TODO: Remove with 1.3, compat only - && ! array_key_exists('contacts', $routeDenylist) - ) { + if (! array_key_exists('contacts', $routeDenylist)) { $section->add(N_('Contacts'), [ 'url' => 'icingadb/contacts', 'priority' => 80, diff --git a/doc/05-Upgrading.md b/doc/05-Upgrading.md index acf576b6..643e5a14 100644 --- a/doc/05-Upgrading.md +++ b/doc/05-Upgrading.md @@ -7,6 +7,10 @@ If you are upgrading across multiple versions, make sure to follow the steps for **Removed Features** +* The routes `users`, `user`, `usergroup` and `usergroups` have been removed. + * Accessing these routes will result in a 404 error. + * The corresponding values for `icingadb/denylist/routes` have no effect anymore. + * The alternatives (`contacts`, `contact` , `contactgroup` and `contactgroups`) have been available since v1.2. * The migration widget in the top right has been removed. If you have not adjusted your navigation items, dashboards and bookmarks to support the new filter syntax, you will need to do so manually now (see [Upgrading to Icinga DB Web v1.1](#upgrading-to-icinga-db-web-v11) for details). diff --git a/library/Icingadb/Common/Auth.php b/library/Icingadb/Common/Auth.php index 0037cf96..f275fe58 100644 --- a/library/Icingadb/Common/Auth.php +++ b/library/Icingadb/Common/Auth.php @@ -43,12 +43,6 @@ trait Auth }, $this->getAuth()->getRestrictions('icingadb/denylist/routes')))); if (! array_key_exists($name, $routeDenylist)) { - if ($name === 'contacts' && array_key_exists('users', $routeDenylist)) { - return false; // TODO: Remove with 1.3, compat only - } elseif ($name === 'contactgroups' && array_key_exists('usergroups', $routeDenylist)) { - return false; // TODO: Remove with 1.3, compat only - } - return true; }