SyncRuleForm: add a note regarding filters

This commit is contained in:
Thomas Gelf 2019-09-06 09:45:44 +02:00
parent 4fcda464e8
commit 90c07943e4
1 changed files with 23 additions and 21 deletions

View File

@ -26,29 +26,29 @@ class SyncRuleForm extends DirectorObjectForm
'zone' => $this->translate('Zone'), 'zone' => $this->translate('Zone'),
]; ];
$this->addElement('text', 'rule_name', array( $this->addElement('text', 'rule_name', [
'label' => $this->translate('Rule name'), 'label' => $this->translate('Rule name'),
'description' => $this->translate('Please provide a rule name'), 'description' => $this->translate('Please provide a rule name'),
'required' => true, 'required' => true,
)); ]);
$this->addElement('textarea', 'description', array( $this->addElement('textarea', 'description', [
'label' => $this->translate('Description'), 'label' => $this->translate('Description'),
'description' => $this->translate( 'description' => $this->translate(
'An extended description for this Sync Rule. This should explain' 'An extended description for this Sync Rule. This should explain'
. ' what this Rule is going to accomplish.' . ' what this Rule is going to accomplish.'
), ),
'rows' => '3', 'rows' => '3',
)); ]);
$this->addElement('select', 'object_type', array( $this->addElement('select', 'object_type', [
'label' => $this->translate('Object Type'), 'label' => $this->translate('Object Type'),
'description' => $this->translate('Choose an object type'), 'description' => $this->translate('Choose an object type'),
'required' => true, 'required' => true,
'multiOptions' => $this->optionalEnum($availableTypes) 'multiOptions' => $this->optionalEnum($availableTypes)
)); ]);
$this->addElement('select', 'update_policy', array( $this->addElement('select', 'update_policy', [
'label' => $this->translate('Update Policy'), 'label' => $this->translate('Update Policy'),
'description' => $this->translate( 'description' => $this->translate(
'Define what should happen when an object with a matching key' 'Define what should happen when an object with a matching key'
@ -57,28 +57,25 @@ class SyncRuleForm extends DirectorObjectForm
. ' it (helpful for one-time imports)' . ' it (helpful for one-time imports)'
), ),
'required' => true, 'required' => true,
'multiOptions' => $this->optionalEnum(array( 'multiOptions' => $this->optionalEnum([
'merge' => $this->translate('Merge'), 'merge' => $this->translate('Merge'),
'override' => $this->translate('Replace'), 'override' => $this->translate('Replace'),
'ignore' => $this->translate('Ignore'), 'ignore' => $this->translate('Ignore'),
)) ])
)); ]);
$this->addElement('select', 'purge_existing', array( $this->addBoolean('purge_existing', [
'label' => $this->translate('Purge'), 'label' => $this->translate('Purge'),
'description' => $this->translate( 'description' => $this->translate(
'Whether to purge existing objects. This means that objects of' 'Whether to purge existing objects. This means that objects of'
. ' the same type will be removed from Director in case they no' . ' the same type will be removed from Director in case they no'
. ' longer exist at your import source.' . ' longer exist at your import source.'
), ),
'required' => true, 'required' => true,
'multiOptions' => $this->optionalEnum(array(
'y' => $this->translate('Yes'),
'n' => $this->translate('No')
))
));
$this->addElement('text', 'filter_expression', array( ]);
$this->addElement('text', 'filter_expression', [
'label' => $this->translate('Filter Expression'), 'label' => $this->translate('Filter Expression'),
'description' => sprintf( 'description' => sprintf(
$this->translate( $this->translate(
@ -86,8 +83,13 @@ class SyncRuleForm extends DirectorObjectForm
. ' filter syntax is allowed, so this could look as follows: %s' . ' filter syntax is allowed, so this could look as follows: %s'
), ),
'(host=a|host=b)&!ip=127.*' '(host=a|host=b)&!ip=127.*'
) . ' ' . $this->translate(
'Be careful: this is usually NOT what you want, as it makes Sync "blind"'
. ' for objects matching this filter. This means that "Purge" will not'
. ' work as expected. The "Black/Whitelist" Import Property Modifier'
. ' is probably what you\'re looking for.'
), ),
)); ]);
$this->setButtons(); $this->setButtons();
} }