Drop user, users, usergroup and usergroups endpoints

This commit is contained in:
Johannes Meyer 2025-11-14 14:41:05 +01:00
parent 555f1417bd
commit 601753a76b
7 changed files with 8 additions and 134 deletions

View file

@ -1,28 +0,0 @@
<?php
/* Icinga DB Web | (c) 2025 Icinga GmbH | GPLv2 */
namespace Icinga\Module\Icingadb\Controllers;
use Icinga\Module\Icingadb\Web\Controller;
/**
* @deprecated Will be removed with 1.3, use ContactController instead
*/
class UserController extends Controller
{
public function preDispatch()
{
$url = $this->getRequest()->getUrl();
$url->setPath(preg_replace(
'~^icingadb/user(?=/|$)~',
'icingadb/contact',
$url->getPath()
));
$this->getResponse()
->setHttpResponseCode(301)
->setHeader('Location', $url->getAbsoluteUrl())
->sendResponse();
}
}

View file

@ -1,28 +0,0 @@
<?php
/* Icinga DB Web | (c) 2025 Icinga GmbH | GPLv2 */
namespace Icinga\Module\Icingadb\Controllers;
use Icinga\Module\Icingadb\Web\Controller;
/**
* @deprecated Will be removed with 1.3, use ContactgroupController instead
*/
class UsergroupController extends Controller
{
public function preDispatch()
{
$url = $this->getRequest()->getUrl();
$url->setPath(preg_replace(
'~^icingadb/usergroup(?=/|$)~',
'icingadb/contactgroup',
$url->getPath()
));
$this->getResponse()
->setHttpResponseCode(301)
->setHeader('Location', $url->getAbsoluteUrl())
->sendResponse();
}
}

View file

@ -1,28 +0,0 @@
<?php
/* Icinga DB Web | (c) 2025 Icinga GmbH | GPLv2 */
namespace Icinga\Module\Icingadb\Controllers;
use Icinga\Module\Icingadb\Web\Controller;
/**
* @deprecated Will be removed with 1.3, use ContactgroupsController instead
*/
class UsergroupsController extends Controller
{
public function preDispatch()
{
$url = $this->getRequest()->getUrl();
$url->setPath(preg_replace(
'~^icingadb/usergroups(?=/|$)~',
'icingadb/contactgroups',
$url->getPath()
));
$this->getResponse()
->setHttpResponseCode(301)
->setHeader('Location', $url->getAbsoluteUrl())
->sendResponse();
}
}

View file

@ -1,28 +0,0 @@
<?php
/* Icinga DB Web | (c) 2025 Icinga GmbH | GPLv2 */
namespace Icinga\Module\Icingadb\Controllers;
use Icinga\Module\Icingadb\Web\Controller;
/**
* @deprecated Will be removed with 1.3, use ContactsController instead
*/
class UsersController extends Controller
{
public function preDispatch()
{
$url = $this->getRequest()->getUrl();
$url->setPath(preg_replace(
'~^icingadb/users(?=/|$)~',
'icingadb/contacts',
$url->getPath()
));
$this->getResponse()
->setHttpResponseCode(301)
->setHeader('Location', $url->getAbsoluteUrl())
->sendResponse();
}
}

View file

@ -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,

View file

@ -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).

View file

@ -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;
}