mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 08:44:11 +02:00
parent
f42028c40f
commit
18f9e729e4
@ -28,6 +28,7 @@ next (will be 1.8.0)
|
||||
* FEATURE: New Property Modifier: ListToObject (#2062)
|
||||
* FEATURE: Property Modifier: convert binary UUID to HEX presentation (#2138)
|
||||
* FEATURE: Property Modifier: get Host by Address (#2210)
|
||||
* FEATURE: Property Modifier: skip duplicates (#2215)
|
||||
* FEATURE: Import Sources now allow to download previewed data as JSON (#2096)
|
||||
* FEATURE: UTF8 validation for failed imports gives better error message (#2143)
|
||||
* FIX: LDAP Import is now able to paginate limited results (#2019)
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\PropertyModifier;
|
||||
|
||||
use Icinga\Module\Director\Hook\PropertyModifierHook;
|
||||
|
||||
class PropertyModifierSkipDuplicates extends PropertyModifierHook
|
||||
{
|
||||
private $seen = [];
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return mt('director', 'Skip row if this value appears more than once');
|
||||
}
|
||||
|
||||
public function transform($value)
|
||||
{
|
||||
if (isset($this->seen[$value])) {
|
||||
$this->rejectRow();
|
||||
}
|
||||
|
||||
$this->seen[$value] = true;
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
@ -41,6 +41,7 @@ use Icinga\Module\Director\PropertyModifier\PropertyModifierRegexReplace;
|
||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierRegexSplit;
|
||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierRejectOrSelect;
|
||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierReplace;
|
||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierSkipDuplicates;
|
||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierSplit;
|
||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierStripDomain;
|
||||
use Icinga\Module\Director\PropertyModifier\PropertyModifierSubstring;
|
||||
@ -105,6 +106,7 @@ $directorHooks = [
|
||||
PropertyModifierRegexSplit::class,
|
||||
PropertyModifierRejectOrSelect::class,
|
||||
PropertyModifierReplace::class,
|
||||
PropertyModifierSkipDuplicates::class,
|
||||
PropertyModifierSplit::class,
|
||||
PropertyModifierStripDomain::class,
|
||||
PropertyModifierSubstring::class,
|
||||
|
Loading…
x
Reference in New Issue
Block a user