monitoring/security: Hide delete downtime action in the downtimes overview if user lacks the respective permission

This commit is contained in:
Eric Lippmann 2015-01-23 09:16:30 +01:00
parent 5967d5fe04
commit ac5ac10feb
2 changed files with 6 additions and 1 deletions

View File

@ -306,7 +306,10 @@ class Monitoring_ListController extends Controller
)); ));
$this->view->downtimes = $query->paginate(); $this->view->downtimes = $query->paginate();
$this->view->delDowntimeForm = new DeleteDowntimeCommandForm();
if ($this->Auth()->hasPermission('monitoring/command/downtime/delete')) {
$this->view->delDowntimeForm = new DeleteDowntimeCommandForm();
}
} }
/** /**

View File

@ -114,6 +114,7 @@ use Icinga\Module\Monitoring\Object\Service;
<?php endif ?> <?php endif ?>
</small> </small>
</td> </td>
<?php if (isset($delDowntimeForm)): // Form is unset if the current user lacks the respective permission ?>
<td style="width: 2em" data-base-target="self"> <td style="width: 2em" data-base-target="self">
<?php <?php
$delDowntimeForm = clone $delDowntimeForm; $delDowntimeForm = clone $delDowntimeForm;
@ -126,6 +127,7 @@ use Icinga\Module\Monitoring\Object\Service;
echo $delDowntimeForm; echo $delDowntimeForm;
?> ?>
</td> </td>
<?php endif ?>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>