From 7c19368db58f16858fde7f1c5fe50c0d640c0482 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 13:45:00 +0200 Subject: Adding upstream version 1.1.2. Signed-off-by: Daniel Baumann --- application/forms/Command/Object/AcknowledgeProblemForm.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'application/forms/Command/Object/AcknowledgeProblemForm.php') diff --git a/application/forms/Command/Object/AcknowledgeProblemForm.php b/application/forms/Command/Object/AcknowledgeProblemForm.php index 81b93e2..f5e7923 100644 --- a/application/forms/Command/Object/AcknowledgeProblemForm.php +++ b/application/forms/Command/Object/AcknowledgeProblemForm.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Icingadb\Forms\Command\Object; +use CallbackFilterIterator; use DateInterval; use DateTime; use Icinga\Application\Config; @@ -14,9 +15,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; use function ipl\Stdlib\iterable_value_first; @@ -186,10 +189,13 @@ class AcknowledgeProblemForm 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/acknowledge-problem', $objects); + $granted = new CallbackFilterIterator($objects, function (Model $object): bool { + return $this->isGrantedOn('icingadb/command/acknowledge-problem', $object); + }); + $granted->rewind(); // Forwards the pointer to the first element if ($granted->valid()) { $command = new AcknowledgeProblemCommand(); $command->setObjects($granted); -- cgit v1.2.3