ServicesController: Don't allow to reschedule checks if no objects have active ones

refs #3665
This commit is contained in:
Johannes Meyer 2019-02-01 13:33:00 +01:00
parent f45b4640b0
commit 164555760b
2 changed files with 12 additions and 3 deletions

View File

@ -92,7 +92,12 @@ class ServicesController extends Controller
public function showAction()
{
$this->setAutorefreshInterval(15);
if ($this->Auth()->hasPermission('monitoring/command/schedule-check')) {
$activeChecksEnabled = $this->serviceList->getFeatureStatus()['active_checks_enabled'] !== 0;
if ($this->Auth()->hasPermission('monitoring/command/schedule-check')
|| ($this->Auth()->hasPermission('monitoring/command/schedule-check/active-only')
&& $activeChecksEnabled
)
) {
$checkNowForm = new CheckNowCommandForm();
$checkNowForm
->setObjects($this->serviceList)
@ -119,8 +124,10 @@ class ServicesController extends Controller
->handleRequest();
$this->view->toggleFeaturesForm = $toggleFeaturesForm;
$this->setAutorefreshInterval(15);
$this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/services/reschedule-check');
if ($activeChecksEnabled) {
$this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/services/reschedule-check');
}
$this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/services/schedule-downtime');
$this->view->processCheckResultAllLink = Url::fromRequest()->setPath(
'monitoring/services/process-check-result'

View File

@ -183,6 +183,7 @@
</tr>
<?php endif ?>
<?php if (isset($rescheduleAllLink)): ?>
<tr>
<th></th>
<td>
@ -197,6 +198,7 @@
) ?>
</td>
</tr>
<?php endif ?>
</tbody>
</table>
<h2><?= $this->translate('Feature Commands') ?></h2>