98 lines
2.7 KiB
PHP
98 lines
2.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Services\TenantConfiguration;
|
|
|
|
final class ExchangeTransportRuleEvidenceNormalizer extends ExchangePowerShellTargetEvidenceNormalizer
|
|
{
|
|
public function resourceType(): string
|
|
{
|
|
return 'transportRule';
|
|
}
|
|
|
|
public function normalizerVersion(): string
|
|
{
|
|
return 'exchange-transport-rule-readiness-v1';
|
|
}
|
|
|
|
/**
|
|
* @return list<string>
|
|
*/
|
|
protected function materialFields(): array
|
|
{
|
|
return [
|
|
'Guid',
|
|
'RuleId',
|
|
'Identity',
|
|
'DisplayName',
|
|
'Name',
|
|
'Priority',
|
|
'Mode',
|
|
'State',
|
|
'Enabled',
|
|
'From',
|
|
'RecipientDomainIs',
|
|
'SenderDomainIs',
|
|
'SentTo',
|
|
'SubjectContainsWords',
|
|
'SubjectOrBodyContainsWords',
|
|
'BodyContainsWords',
|
|
'ApplyHtmlDisclaimerText',
|
|
'ApplyHtmlDisclaimerFallbackAction',
|
|
'ApplyHtmlDisclaimerLocation',
|
|
'DeleteMessage',
|
|
'RedirectMessageTo',
|
|
'ExceptIfFrom',
|
|
'ExceptIfRecipientDomainIs',
|
|
'HeaderContainsWords',
|
|
'SetHeaderValue',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return list<list<string>>
|
|
*/
|
|
protected function identityAliasGroups(): array
|
|
{
|
|
return [
|
|
['id', 'sourceId'],
|
|
['Guid', 'RuleId'],
|
|
];
|
|
}
|
|
|
|
protected function normalizePayload(array $payload, array $identity): array
|
|
{
|
|
$normalized = parent::normalizePayload($payload, $identity);
|
|
|
|
$normalized['rule_order'] = [
|
|
'priority' => $this->normalizeSettingValue($payload['Priority'] ?? $payload['priority'] ?? null),
|
|
'order_is_identity' => false,
|
|
];
|
|
$normalized['conditions'] = $this->settingGroup($payload, ['Conditions', 'conditions'], [
|
|
'From',
|
|
'RecipientDomainIs',
|
|
'SenderDomainIs',
|
|
'SentTo',
|
|
'SubjectContainsWords',
|
|
'SubjectOrBodyContainsWords',
|
|
'BodyContainsWords',
|
|
]);
|
|
$normalized['actions'] = $this->settingGroup($payload, ['Actions', 'actions'], [
|
|
'ApplyHtmlDisclaimerText',
|
|
'ApplyHtmlDisclaimerFallbackAction',
|
|
'ApplyHtmlDisclaimerLocation',
|
|
'DeleteMessage',
|
|
'RedirectMessageTo',
|
|
'HeaderContainsWords',
|
|
'SetHeaderValue',
|
|
]);
|
|
$normalized['exceptions'] = $this->settingGroup($payload, ['Exceptions', 'exceptions'], [
|
|
'ExceptIfFrom',
|
|
'ExceptIfRecipientDomainIs',
|
|
]);
|
|
|
|
return $this->sortAssociative($normalized);
|
|
}
|
|
}
|