|
136 | 136 | );
|
137 | 137 |
|
138 | 138 | if (! $this::exists('monitoring') || ($authenticated && ! $auth->getUser()->can('module/monitoring'))) {
|
| 139 | + $routeDenylist = []; |
| 140 | + if ($authenticated && ! $auth->getUser()->isUnrestricted()) { |
| 141 | + // The empty array is for PHP pre 7.4, older versions require at least a single param for array_merge |
| 142 | + $routeDenylist = array_flip(array_merge([], ...array_map(function ($restriction) { |
| 143 | + return StringHelper::trimSplit($restriction); |
| 144 | + }, $auth->getRestrictions('icingadb/denylist/routes')))); |
| 145 | + } |
| 146 | + |
139 | 147 | /*
|
140 | 148 | * Available navigation items
|
141 | 149 | */
|
|
165 | 173 | 'icingadb/services?sort=service.state.severity&limit=10',
|
166 | 174 | 97
|
167 | 175 | );
|
168 |
| - $this->provideSearchUrl( |
169 |
| - $this->translate('Hostgroups'), |
170 |
| - 'icingadb/hostgroups?limit=10', |
171 |
| - 96 |
172 |
| - ); |
173 |
| - $this->provideSearchUrl( |
174 |
| - $this->translate('Servicegroups'), |
175 |
| - 'icingadb/servicegroups?limit=10', |
176 |
| - 95 |
177 |
| - ); |
| 176 | + |
| 177 | + if (! array_key_exists('hostgroups', $routeDenylist)) { |
| 178 | + $this->provideSearchUrl( |
| 179 | + $this->translate('Hostgroups'), |
| 180 | + 'icingadb/hostgroups?limit=10', |
| 181 | + 96 |
| 182 | + ); |
| 183 | + } |
| 184 | + |
| 185 | + if (! array_key_exists('servicegroups', $routeDenylist)) { |
| 186 | + $this->provideSearchUrl( |
| 187 | + $this->translate('Servicegroups'), |
| 188 | + 'icingadb/servicegroups?limit=10', |
| 189 | + 95 |
| 190 | + ); |
| 191 | + } |
178 | 192 |
|
179 | 193 | /**
|
180 | 194 | * Current Incidents
|
|
340 | 354 | 'url' => 'icingadb/services',
|
341 | 355 | 'icon' => 'cog'
|
342 | 356 | ]);
|
343 |
| - $routeDenylist = []; |
344 |
| - if ($authenticated && ! $auth->getUser()->isUnrestricted()) { |
345 |
| - // The empty array is for PHP pre 7.4, older versions require at least a single param for array_merge |
346 |
| - $routeDenylist = array_flip(array_merge([], ...array_map(function ($restriction) { |
347 |
| - return StringHelper::trimSplit($restriction); |
348 |
| - }, $auth->getRestrictions('icingadb/denylist/routes')))); |
349 |
| - } |
350 | 357 |
|
351 | 358 | if (! array_key_exists('hostgroups', $routeDenylist)) {
|
352 | 359 | $overviewSection->add(N_('Host Groups'), [
|
|
0 commit comments