summaryrefslogtreecommitdiffstats
path: root/application/forms/Command/Object/ScheduleServiceDowntimeForm.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:45:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:45:00 +0000
commitbe4626482ba8761da39746a6ac60d133d3852a0f (patch)
tree45065832c85c4789237e94b3114360eac91d86f0 /application/forms/Command/Object/ScheduleServiceDowntimeForm.php
parentReleasing progress-linux version 1.1.1-1~progress7.99u1. (diff)
downloadicingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.tar.xz
icingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.zip
Merging upstream version 1.1.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'application/forms/Command/Object/ScheduleServiceDowntimeForm.php')
-rw-r--r--application/forms/Command/Object/ScheduleServiceDowntimeForm.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/application/forms/Command/Object/ScheduleServiceDowntimeForm.php b/application/forms/Command/Object/ScheduleServiceDowntimeForm.php
index 184a4e8..b237408 100644
--- a/application/forms/Command/Object/ScheduleServiceDowntimeForm.php
+++ b/application/forms/Command/Object/ScheduleServiceDowntimeForm.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
+use CallbackFilterIterator;
use DateInterval;
use DateTime;
use Icinga\Application\Config;
@@ -13,9 +14,11 @@ use Icinga\Web\Notification;
use ipl\Html\Attributes;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
+use ipl\Orm\Model;
use ipl\Validator\CallbackValidator;
use ipl\Web\FormDecorator\IcingaFormDecorator;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
class ScheduleServiceDowntimeForm extends CommandForm
@@ -242,10 +245,13 @@ class ScheduleServiceDowntimeForm extends CommandForm
(new IcingaFormDecorator())->decorate($this->getElement('btn_submit'));
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = $this->filterGrantedOn('icingadb/command/downtime/schedule', $objects);
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $this->isGrantedOn('icingadb/command/downtime/schedule', $object);
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new ScheduleServiceDowntimeCommand();
$command->setObjects($granted);