diff --git a/application/clicommands/MigrateCommand.php b/application/clicommands/MigrateCommand.php index 17892bb4..74b4ac4a 100644 --- a/application/clicommands/MigrateCommand.php +++ b/application/clicommands/MigrateCommand.php @@ -357,7 +357,7 @@ class MigrateCommand extends Command } elseif ($permission === 'no-monitoring/contacts') { $changed = true; $updatedPermissions[] = $permission; - $role['icingadb/denylist/routes'] = 'users,usergroups'; + $role['icingadb/denylist/routes'] = 'contacts,contactgroups'; } else { $updatedPermissions[] = $permission; } diff --git a/application/controllers/ContactController.php b/application/controllers/ContactController.php new file mode 100644 index 00000000..3115fb10 --- /dev/null +++ b/application/controllers/ContactController.php @@ -0,0 +1,48 @@ +assertRouteAccess('contacts'); + + $this->addTitleTab(t('Contact')); + + $name = $this->params->getRequired('name'); + + $query = User::on($this->getDb())->with('timeperiod'); + $query->filter(Filter::equal('user.name', $name)); + + $this->applyRestrictions($query); + + $user = $query->first(); + if ($user === null) { + throw new NotFoundError(t('Contact not found')); + } + + $this->user = $user; + $this->setTitle($user->display_name); + } + + public function indexAction() + { + $this->addControl(new ObjectHeader($this->user)); + $this->addContent(new UserDetail($this->user)); + + $this->setAutorefreshInterval(10); + } +} diff --git a/application/controllers/ContactgroupController.php b/application/controllers/ContactgroupController.php new file mode 100644 index 00000000..22fcf4c7 --- /dev/null +++ b/application/controllers/ContactgroupController.php @@ -0,0 +1,48 @@ +assertRouteAccess('contactgroups'); + + $this->addTitleTab(t('Contact Group')); + + $name = $this->params->getRequired('name'); + + $query = Usergroup::on($this->getDb()); + $query->filter(Filter::equal('usergroup.name', $name)); + + $this->applyRestrictions($query); + + $usergroup = $query->first(); + if ($usergroup === null) { + throw new NotFoundError(t('Contact group not found')); + } + + $this->usergroup = $usergroup; + $this->setTitle($usergroup->display_name); + } + + public function indexAction() + { + $this->addControl(new ObjectHeader($this->usergroup)); + $this->addContent(new UsergroupDetail($this->usergroup)); + + $this->setAutorefreshInterval(10); + } +} diff --git a/application/controllers/ContactgroupsController.php b/application/controllers/ContactgroupsController.php new file mode 100644 index 00000000..a19d9b1d --- /dev/null +++ b/application/controllers/ContactgroupsController.php @@ -0,0 +1,96 @@ +assertRouteAccess(); + } + + public function indexAction() + { + $this->addTitleTab(t('Contact Groups')); + + $db = $this->getDb(); + + $usergroups = Usergroup::on($db); + + $limitControl = $this->createLimitControl(); + $paginationControl = $this->createPaginationControl($usergroups); + $sortControl = $this->createSortControl( + $usergroups, + [ + 'usergroup.display_name' => t('Name') + ] + ); + $searchBar = $this->createSearchBar($usergroups, [ + $limitControl->getLimitParam(), + $sortControl->getSortParam() + ]); + + if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) { + if ($searchBar->hasBeenSubmitted()) { + $filter = $this->getFilter(); + } else { + $this->addControl($searchBar); + $this->sendMultipartUpdate(); + return; + } + } else { + $filter = $searchBar->getFilter(); + } + + $this->filter($usergroups, $filter); + + yield $this->export($usergroups); + + $this->addControl($paginationControl); + $this->addControl($sortControl); + $this->addControl($limitControl); + $this->addControl($searchBar); + + $this->addContent(new ObjectList($usergroups)); + + if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) { + $this->sendMultipartUpdate(); + } + + $this->setAutorefreshInterval(10); + } + + public function completeAction() + { + $suggestions = new ObjectSuggestions(); + $suggestions->setModel(Usergroup::class); + $suggestions->forRequest(ServerRequest::fromGlobals()); + $this->getDocument()->add($suggestions); + } + + public function searchEditorAction() + { + $editor = $this->createSearchEditor(Usergroup::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } +} diff --git a/application/controllers/ContactsController.php b/application/controllers/ContactsController.php new file mode 100644 index 00000000..9d4cbfb8 --- /dev/null +++ b/application/controllers/ContactsController.php @@ -0,0 +1,97 @@ +assertRouteAccess(); + } + + public function indexAction() + { + $this->addTitleTab(t('Contacts')); + + $db = $this->getDb(); + + $users = User::on($db); + + $limitControl = $this->createLimitControl(); + $paginationControl = $this->createPaginationControl($users); + $sortControl = $this->createSortControl( + $users, + [ + 'user.display_name' => t('Name'), + 'user.email' => t('Email'), + 'user.pager' => t('Pager Address / Number') + ] + ); + $searchBar = $this->createSearchBar($users, [ + $limitControl->getLimitParam(), + $sortControl->getSortParam() + ]); + + if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) { + if ($searchBar->hasBeenSubmitted()) { + $filter = $this->getFilter(); + } else { + $this->addControl($searchBar); + $this->sendMultipartUpdate(); + return; + } + } else { + $filter = $searchBar->getFilter(); + } + + $this->filter($users, $filter); + + yield $this->export($users); + + $this->addControl($paginationControl); + $this->addControl($sortControl); + $this->addControl($limitControl); + $this->addControl($searchBar); + + $this->addContent(new ObjectList($users)); + + if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) { + $this->sendMultipartUpdate(); + } + + $this->setAutorefreshInterval(10); + } + + public function completeAction() + { + $suggestions = new ObjectSuggestions(); + $suggestions->setModel(User::class); + $suggestions->forRequest(ServerRequest::fromGlobals()); + $this->getDocument()->add($suggestions); + } + + public function searchEditorAction() + { + $editor = $this->createSearchEditor(User::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } +} diff --git a/application/controllers/UserController.php b/application/controllers/UserController.php index 6afc0921..6d64f844 100644 --- a/application/controllers/UserController.php +++ b/application/controllers/UserController.php @@ -1,48 +1,28 @@ assertRouteAccess('users'); + $url = $this->getRequest()->getUrl(); + $url->setPath(preg_replace( + '~^icingadb/user(?=/|$)~', + 'icingadb/contact', + $url->getPath() + )); - $this->addTitleTab(t('User')); - - $name = $this->params->getRequired('name'); - - $query = User::on($this->getDb())->with('timeperiod'); - $query->filter(Filter::equal('user.name', $name)); - - $this->applyRestrictions($query); - - $user = $query->first(); - if ($user === null) { - throw new NotFoundError(t('User not found')); - } - - $this->user = $user; - $this->setTitle($user->display_name); - } - - public function indexAction() - { - $this->addControl(new ObjectHeader($this->user)); - $this->addContent(new UserDetail($this->user)); - - $this->setAutorefreshInterval(10); + $this->getResponse() + ->setHttpResponseCode(301) + ->setHeader('Location', $url->getAbsoluteUrl()) + ->sendResponse(); } } diff --git a/application/controllers/UsergroupController.php b/application/controllers/UsergroupController.php index 9ea90b9b..c3546415 100644 --- a/application/controllers/UsergroupController.php +++ b/application/controllers/UsergroupController.php @@ -1,48 +1,28 @@ assertRouteAccess('usergroups'); + $url = $this->getRequest()->getUrl(); + $url->setPath(preg_replace( + '~^icingadb/usergroup(?=/|$)~', + 'icingadb/contactgroup', + $url->getPath() + )); - $this->addTitleTab(t('User Group')); - - $name = $this->params->getRequired('name'); - - $query = Usergroup::on($this->getDb()); - $query->filter(Filter::equal('usergroup.name', $name)); - - $this->applyRestrictions($query); - - $usergroup = $query->first(); - if ($usergroup === null) { - throw new NotFoundError(t('User group not found')); - } - - $this->usergroup = $usergroup; - $this->setTitle($usergroup->display_name); - } - - public function indexAction() - { - $this->addControl(new ObjectHeader($this->usergroup)); - $this->addContent(new UsergroupDetail($this->usergroup)); - - $this->setAutorefreshInterval(10); + $this->getResponse() + ->setHttpResponseCode(301) + ->setHeader('Location', $url->getAbsoluteUrl()) + ->sendResponse(); } } diff --git a/application/controllers/UsergroupsController.php b/application/controllers/UsergroupsController.php index 4a024117..306a69f7 100644 --- a/application/controllers/UsergroupsController.php +++ b/application/controllers/UsergroupsController.php @@ -1,96 +1,28 @@ getRequest()->getUrl(); + $url->setPath(preg_replace( + '~^icingadb/usergroups(?=/|$)~', + 'icingadb/contactgroups', + $url->getPath() + )); - $this->assertRouteAccess(); - } - - public function indexAction() - { - $this->addTitleTab(t('User Groups')); - - $db = $this->getDb(); - - $usergroups = Usergroup::on($db); - - $limitControl = $this->createLimitControl(); - $paginationControl = $this->createPaginationControl($usergroups); - $sortControl = $this->createSortControl( - $usergroups, - [ - 'usergroup.display_name' => t('Name') - ] - ); - $searchBar = $this->createSearchBar($usergroups, [ - $limitControl->getLimitParam(), - $sortControl->getSortParam() - ]); - - if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) { - if ($searchBar->hasBeenSubmitted()) { - $filter = $this->getFilter(); - } else { - $this->addControl($searchBar); - $this->sendMultipartUpdate(); - return; - } - } else { - $filter = $searchBar->getFilter(); - } - - $this->filter($usergroups, $filter); - - yield $this->export($usergroups); - - $this->addControl($paginationControl); - $this->addControl($sortControl); - $this->addControl($limitControl); - $this->addControl($searchBar); - - $this->addContent(new ObjectList($usergroups)); - - if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) { - $this->sendMultipartUpdate(); - } - - $this->setAutorefreshInterval(10); - } - - public function completeAction() - { - $suggestions = new ObjectSuggestions(); - $suggestions->setModel(Usergroup::class); - $suggestions->forRequest(ServerRequest::fromGlobals()); - $this->getDocument()->add($suggestions); - } - - public function searchEditorAction() - { - $editor = $this->createSearchEditor(Usergroup::on($this->getDb()), [ - LimitControl::DEFAULT_LIMIT_PARAM, - SortControl::DEFAULT_SORT_PARAM, - ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM - ]); - - $this->getDocument()->add($editor); - $this->setTitle(t('Adjust Filter')); + $this->getResponse() + ->setHttpResponseCode(301) + ->setHeader('Location', $url->getAbsoluteUrl()) + ->sendResponse(); } } diff --git a/application/controllers/UsersController.php b/application/controllers/UsersController.php index ea4a87f3..293007f8 100644 --- a/application/controllers/UsersController.php +++ b/application/controllers/UsersController.php @@ -1,98 +1,28 @@ getRequest()->getUrl(); + $url->setPath(preg_replace( + '~^icingadb/users(?=/|$)~', + 'icingadb/contacts', + $url->getPath() + )); - $this->assertRouteAccess(); - } - - public function indexAction() - { - $this->addTitleTab(t('Users')); - - $db = $this->getDb(); - - $users = User::on($db); - - $limitControl = $this->createLimitControl(); - $paginationControl = $this->createPaginationControl($users); - $sortControl = $this->createSortControl( - $users, - [ - 'user.display_name' => t('Name'), - 'user.email' => t('Email'), - 'user.pager' => t('Pager Address / Number') - ] - ); - $searchBar = $this->createSearchBar($users, [ - $limitControl->getLimitParam(), - $sortControl->getSortParam() - ]); - - if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) { - if ($searchBar->hasBeenSubmitted()) { - $filter = $this->getFilter(); - } else { - $this->addControl($searchBar); - $this->sendMultipartUpdate(); - return; - } - } else { - $filter = $searchBar->getFilter(); - } - - $this->filter($users, $filter); - - yield $this->export($users); - - $this->addControl($paginationControl); - $this->addControl($sortControl); - $this->addControl($limitControl); - $this->addControl($searchBar); - - $this->addContent(new ObjectList($users)); - - if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) { - $this->sendMultipartUpdate(); - } - - $this->setAutorefreshInterval(10); - } - - public function completeAction() - { - $suggestions = new ObjectSuggestions(); - $suggestions->setModel(User::class); - $suggestions->forRequest(ServerRequest::fromGlobals()); - $this->getDocument()->add($suggestions); - } - - public function searchEditorAction() - { - $editor = $this->createSearchEditor(User::on($this->getDb()), [ - LimitControl::DEFAULT_LIMIT_PARAM, - SortControl::DEFAULT_SORT_PARAM, - ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM - ]); - - $this->getDocument()->add($editor); - $this->setTitle(t('Adjust Filter')); + $this->getResponse() + ->setHttpResponseCode(301) + ->setHeader('Location', $url->getAbsoluteUrl()) + ->sendResponse(); } } diff --git a/configuration.php b/configuration.php index 16a25f46..72f04b09 100644 --- a/configuration.php +++ b/configuration.php @@ -373,26 +373,30 @@ namespace Icinga\Module\Icingadb { ]); } - if (! array_key_exists('usergroups', $routeDenylist)) { - $overviewSection->add(N_('User Groups'), [ - 'description' => $this->translate('List user groups'), - 'url' => 'icingadb/usergroups', + if ( + ! array_key_exists('usergroups', $routeDenylist) // TODO: Remove with 1.3, compat only + && ! array_key_exists('contactgroups', $routeDenylist) + ) { + $overviewSection->add(N_('Contact Groups'), [ + 'description' => $this->translate('List contact groups'), + 'url' => 'icingadb/contactgroups', 'priority' => 90, 'icon' => 'users' ]); } - if (! array_key_exists('users', $routeDenylist)) { - $overviewSection->add(N_('Users'), [ - 'description' => $this->translate('List users'), - 'url' => 'icingadb/users', + if ( + ! array_key_exists('users', $routeDenylist) // TODO: Remove with 1.3, compat only + && ! array_key_exists('contacts', $routeDenylist) + ) { + $overviewSection->add(N_('Contacts'), [ + 'description' => $this->translate('List contacts'), + 'url' => 'icingadb/contacts', 'priority' => 100, 'icon' => 'user-friends' ]); } - - $overviewSection->add(N_('Comments'), [ 'url' => 'icingadb/comments', 'description' => $this->translate('List comments'), @@ -501,20 +505,26 @@ namespace Icinga\Module\Icingadb { ]); } - if (! array_key_exists('usergroups', $routeDenylist)) { - $section->add(N_('User Groups'), [ - 'url' => 'icingadb/usergroups', + if ( + ! array_key_exists('usergroups', $routeDenylist) // TODO: Remove with 1.3, compat only + && ! array_key_exists('contactgroups', $routeDenylist) + ) { + $section->add(N_('Contact Groups'), [ + 'url' => 'icingadb/contactgroups', 'priority' => 70, - 'description' => $this->translate('List user groups'), + 'description' => $this->translate('List contact groups'), 'icon' => 'users' ]); } - if (! array_key_exists('users', $routeDenylist)) { - $section->add(N_('Users'), [ - 'url' => 'icingadb/users', + if ( + ! array_key_exists('users', $routeDenylist) // TODO: Remove with 1.3, compat only + && ! array_key_exists('contacts', $routeDenylist) + ) { + $section->add(N_('Contacts'), [ + 'url' => 'icingadb/contacts', 'priority' => 80, - 'description' => $this->translate('List users'), + 'description' => $this->translate('List contacts'), 'icon' => 'user-friends' ]); } diff --git a/doc/04-Security.md b/doc/04-Security.md index d3e7545d..c6653d93 100644 --- a/doc/04-Security.md +++ b/doc/04-Security.md @@ -77,7 +77,7 @@ icingadb/denylist/variables | Hide custom variables of Icinga objects that are p `icingadb/denylist/routes` will block users from accessing defined routes and from related information elsewhere. For example, if `hostgroups` are part of the list a user won't have access to the hostgroup overview nor to a host's groups shown in its detail area. This should be a comma separated list. Possible values are: hostgroups, servicegroups, -users, usergroups +contacts, contactgroups `icingadb/denylist/variables` will block users from accessing certain custom variables. A user affected by this won't see that those variables even exist. This should be a comma separated list of [variable paths](#variable-paths). It is diff --git a/doc/10-Migration.md b/doc/10-Migration.md index 43fa1dbd..a03b608b 100644 --- a/doc/10-Migration.md +++ b/doc/10-Migration.md @@ -150,7 +150,7 @@ The command permissions have not changed. It is only the module identifier that `monitoring/command/*` is now `icingadb/command/*` The `no-monitoring/contacts` permission (or *fake refusal*) is now a restriction: `icingadb/denylist/routes`. -Add `users,usergroups` to it to achieve the same effect. +Add `contacts,contactgroups` to it to achieve the same effect. ### Perform The Migration diff --git a/library/Icingadb/Common/Auth.php b/library/Icingadb/Common/Auth.php index 0cabff7b..59e18b77 100644 --- a/library/Icingadb/Common/Auth.php +++ b/library/Icingadb/Common/Auth.php @@ -41,7 +41,17 @@ trait Auth return StringHelper::trimSplit($restriction); }, $this->getAuth()->getRestrictions('icingadb/denylist/routes')))); - return ! array_key_exists($name, $routeDenylist); + 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; + } + + return false; } /** diff --git a/library/Icingadb/Common/Links.php b/library/Icingadb/Common/Links.php index 5968e5fb..d9649591 100644 --- a/library/Icingadb/Common/Links.php +++ b/library/Icingadb/Common/Links.php @@ -118,22 +118,22 @@ abstract class Links public static function user(User $user): Url { - return Url::fromPath('icingadb/user', ['name' => $user->name]); + return Url::fromPath('icingadb/contact', ['name' => $user->name]); } public static function usergroup(Usergroup $usergroup): Url { - return Url::fromPath('icingadb/usergroup', ['name' => $usergroup->name]); + return Url::fromPath('icingadb/contactgroup', ['name' => $usergroup->name]); } public static function users(): Url { - return Url::fromPath('icingadb/users'); + return Url::fromPath('icingadb/contacts'); } public static function usergroups(): Url { - return Url::fromPath('icingadb/usergroups'); + return Url::fromPath('icingadb/contactgroups'); } public static function event(History $event): Url diff --git a/library/Icingadb/Compat/UrlMigrator.php b/library/Icingadb/Compat/UrlMigrator.php index f6a4a4ae..882d13fd 100644 --- a/library/Icingadb/Compat/UrlMigrator.php +++ b/library/Icingadb/Compat/UrlMigrator.php @@ -31,8 +31,8 @@ class UrlMigrator 'monitoring/service/history' => ['service', 'icingadb/service/history'], 'monitoring/list/hostgroups' => ['hostgroups', 'icingadb/hostgroups'], 'monitoring/list/servicegroups' => ['servicegroups', 'icingadb/servicegroups'], - 'monitoring/list/contactgroups' => ['contactgroups', 'icingadb/usergroups'], - 'monitoring/list/contacts' => ['contacts', 'icingadb/users'], + 'monitoring/list/contactgroups' => ['contactgroups', 'icingadb/contactgroups'], + 'monitoring/list/contacts' => ['contacts', 'icingadb/contacts'], 'monitoring/list/comments' => ['comments', 'icingadb/comments'], 'monitoring/list/downtimes' => ['downtimes', 'icingadb/downtimes'], 'monitoring/list/eventhistory' => ['history', 'icingadb/history'], diff --git a/library/Icingadb/Model/NotificationHistory.php b/library/Icingadb/Model/NotificationHistory.php index 08903ad6..bb2ad475 100644 --- a/library/Icingadb/Model/NotificationHistory.php +++ b/library/Icingadb/Model/NotificationHistory.php @@ -80,7 +80,7 @@ class NotificationHistory extends Model 'previous_hard_state' => t('Previous Hard State'), 'author' => t('Notification Author'), 'text' => t('Notification Text'), - 'users_notified' => t('Users Notified') + 'users_notified' => t('Contacts Notified') ]; } diff --git a/library/Icingadb/Model/Usergroup.php b/library/Icingadb/Model/Usergroup.php index 281c9ce5..405cf6ee 100644 --- a/library/Icingadb/Model/Usergroup.php +++ b/library/Icingadb/Model/Usergroup.php @@ -49,11 +49,11 @@ class Usergroup extends Model { return [ 'environment_id' => t('Environment Id'), - 'name_checksum' => t('Usergroup Name Checksum'), - 'properties_checksum' => t('Usergroup Properties Checksum'), - 'name' => t('Usergroup Name'), - 'name_ci' => t('Usergroup Name (CI)'), - 'display_name' => t('Usergroup Display Name'), + 'name_checksum' => t('Contactgroup Name Checksum'), + 'properties_checksum' => t('Contactgroup Properties Checksum'), + 'name' => t('Contactgroup Name'), + 'name_ci' => t('Contactgroup Name (CI)'), + 'display_name' => t('Contactgroup Display Name'), 'zone_id' => t('Zone Id') ]; } diff --git a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php index 0ffa1648..7244704f 100644 --- a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php +++ b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php @@ -55,8 +55,8 @@ class ObjectSuggestions extends Suggestions 'service' => t('Service %s', '..'), 'servicegroup' => t('Servicegroup %s', '..'), 'timeperiod' => t('Timeperiod %s', '..'), - 'user' => t('User %s', '..'), - 'usergroup' => t('Usergroup %s', '..') + 'user' => t('Contact %s', '..'), + 'usergroup' => t('Contactgroup %s', '..') ]; } diff --git a/library/Icingadb/Widget/Detail/EventDetail.php b/library/Icingadb/Widget/Detail/EventDetail.php index f0d0fb07..70ad21a5 100644 --- a/library/Icingadb/Widget/Detail/EventDetail.php +++ b/library/Icingadb/Widget/Detail/EventDetail.php @@ -152,14 +152,14 @@ class EventDetail extends BaseHtmlElement $eventInfo[] = new HorizontalKeyValue($objectKey, $objectInfo); - $notifiedUsers = [new HtmlElement('h2', null, Text::create(t('Notified Users')))]; + $notifiedUsers = [new HtmlElement('h2', null, Text::create(t('Notified Contacts')))]; if ($notification->users_notified === 0) { $notifiedUsers[] = new EmptyState(t('None', 'notified users: none')); - } elseif (! $this->isPermittedRoute('users')) { + } elseif (! $this->isPermittedRoute('contacts')) { $notifiedUsers[] = Text::create(sprintf(tp( - 'This notification was sent to a single user', - 'This notification was sent to %d users', + 'This notification was sent to a single contact', + 'This notification was sent to %d contacts', $notification->users_notified ), $notification->users_notified)); } elseif ($notification->users_notified > 0) { diff --git a/library/Icingadb/Widget/Detail/ObjectDetail.php b/library/Icingadb/Widget/Detail/ObjectDetail.php index 3b8e4678..12557595 100644 --- a/library/Icingadb/Widget/Detail/ObjectDetail.php +++ b/library/Icingadb/Widget/Detail/ObjectDetail.php @@ -402,14 +402,14 @@ class ObjectDetail extends BaseHtmlElement return [ Html::tag('h2', t('Notifications')), new HorizontalKeyValue( - t('Users'), - $userList->hasContent() ? $userList : new EmptyState(t('No users configured.')) + t('Contacts'), + $userList->hasContent() ? $userList : new EmptyState(t('No contacts configured.')) ), new HorizontalKeyValue( - t('User Groups'), + t('Contact Groups'), $usergroupList->hasContent() ? $usergroupList - : new EmptyState(t('No user groups configured.')) + : new EmptyState(t('No contact groups configured.')) ) ]; } @@ -574,7 +574,7 @@ class ObjectDetail extends BaseHtmlElement } $userQuery = null; - if ($this->isPermittedRoute('users')) { + if ($this->isPermittedRoute('contacts')) { $userQuery = User::on($this->getDb()); $userQuery->filter($objectFilter); $this->applyRestrictions($userQuery); @@ -587,7 +587,7 @@ class ObjectDetail extends BaseHtmlElement } } - if ($this->isPermittedRoute('usergroups')) { + if ($this->isPermittedRoute('contactgroups')) { $usergroupQuery = Usergroup::on($this->getDb()); $usergroupQuery->filter($objectFilter); $this->applyRestrictions($usergroupQuery); diff --git a/library/Icingadb/Widget/Detail/UsergroupDetail.php b/library/Icingadb/Widget/Detail/UsergroupDetail.php index c980ed57..6ae1cf26 100644 --- a/library/Icingadb/Widget/Detail/UsergroupDetail.php +++ b/library/Icingadb/Widget/Detail/UsergroupDetail.php @@ -74,7 +74,7 @@ class UsergroupDetail extends BaseHtmlElement ))->setBaseTarget('_next'); return [ - new HtmlElement('h2', null, Text::create(t('Users'))), + new HtmlElement('h2', null, Text::create(t('Contacts'))), new ObjectList($users), $showMoreLink ]; diff --git a/library/Icingadb/Widget/ItemList/ObjectList.php b/library/Icingadb/Widget/ItemList/ObjectList.php index d471647b..40a84e5d 100644 --- a/library/Icingadb/Widget/ItemList/ObjectList.php +++ b/library/Icingadb/Widget/ItemList/ObjectList.php @@ -209,13 +209,13 @@ class ObjectList extends ItemList case $data instanceof User: $this - ->setDetailUrl(Url::fromPath('icingadb/user')) + ->setDetailUrl(Url::fromPath('icingadb/contact')) ->addDetailFilterAttribute($item, Filter::equal('name', $object->name)); break; case $object instanceof Usergroup: $this - ->setDetailUrl(Url::fromPath('icingadb/usergroup')) + ->setDetailUrl(Url::fromPath('icingadb/contactgroup')) ->addDetailFilterAttribute($item, Filter::equal('name', $object->name)); break; diff --git a/test/php/application/clicommands/MigrateCommandTest.php b/test/php/application/clicommands/MigrateCommandTest.php index 2f591aca..c82a10ed 100644 --- a/test/php/application/clicommands/MigrateCommandTest.php +++ b/test/php/application/clicommands/MigrateCommandTest.php @@ -499,7 +499,7 @@ class MigrateCommandTest extends TestCase ], 'no-monitoring-contacts' => [ 'permissions' => 'module/monitoring,no-monitoring/contacts', - 'icingadb/denylist/routes' => 'users,usergroups' + 'icingadb/denylist/routes' => 'contacts,contactgroups' ], 'reporting-only' => [ 'permissions' => 'module/reporting'