Skip to content

Commit 180e34c

Browse files
Merge pull request KelvinTegelaar#1345 from Ren-Roros-Digital/DoNotRewriteUrls
feat: Added DoNotRewriteUrls and AllowedSenderDomains
2 parents 6fe4a92 + 99ff31f commit 180e34c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSafeLinksPolicy.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Invoke-CIPPStandardSafeLinksPolicy {
5959

6060
$CurrentState = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-SafeLinksPolicy' |
6161
Where-Object -Property Name -EQ $PolicyName |
62-
Select-Object Name, EnableSafeLinksForEmail, EnableSafeLinksForTeams, EnableSafeLinksForOffice, TrackClicks, AllowClickThrough, ScanUrls, EnableForInternalSenders, DeliverMessageAfterScan, DisableUrlRewrite, EnableOrganizationBranding
62+
Select-Object Name, EnableSafeLinksForEmail, EnableSafeLinksForTeams, EnableSafeLinksForOffice, TrackClicks, AllowClickThrough, ScanUrls, EnableForInternalSenders, DeliverMessageAfterScan, DisableUrlRewrite, EnableOrganizationBranding, DoNotRewriteUrls
6363

6464
$StateIsCorrect = ($CurrentState.Name -eq $PolicyName) -and
6565
($CurrentState.EnableSafeLinksForEmail -eq $true) -and
@@ -71,7 +71,8 @@ function Invoke-CIPPStandardSafeLinksPolicy {
7171
($CurrentState.DeliverMessageAfterScan -eq $true) -and
7272
($CurrentState.AllowClickThrough -eq $Settings.AllowClickThrough) -and
7373
($CurrentState.DisableUrlRewrite -eq $Settings.DisableUrlRewrite) -and
74-
($CurrentState.EnableOrganizationBranding -eq $Settings.EnableOrganizationBranding)
74+
($CurrentState.EnableOrganizationBranding -eq $Settings.EnableOrganizationBranding) -and
75+
(!(Compare-Object -ReferenceObject $CurrentState.DoNotRewriteUrls -DifferenceObject ($Settings.DoNotRewriteUrls.value ?? $Settings.DoNotRewriteUrls)))
7576

7677
$AcceptedDomains = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AcceptedDomain'
7778

@@ -100,6 +101,7 @@ function Invoke-CIPPStandardSafeLinksPolicy {
100101
AllowClickThrough = $Settings.AllowClickThrough
101102
DisableUrlRewrite = $Settings.DisableUrlRewrite
102103
EnableOrganizationBranding = $Settings.EnableOrganizationBranding
104+
DoNotRewriteUrls = $Settings.DoNotRewriteUrls.value ?? @{"@odata.type" = "#Exchange.GenericHashTable"}
103105
}
104106

105107
if ($CurrentState.Name -eq $Policyname) {

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSpamFilterPolicy.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ function Invoke-CIPPStandardSpamFilterPolicy {
100100
($CurrentState.EnableLanguageBlockList -eq $Settings.EnableLanguageBlockList) -and
101101
((-not $CurrentState.LanguageBlockList -and -not $Settings.LanguageBlockList.value) -or (!(Compare-Object -ReferenceObject $CurrentState.LanguageBlockList -DifferenceObject $Settings.LanguageBlockList.value))) -and
102102
($CurrentState.EnableRegionBlockList -eq $Settings.EnableRegionBlockList) -and
103-
((-not $CurrentState.RegionBlockList -and -not $Settings.RegionBlockList.value) -or (!(Compare-Object -ReferenceObject $CurrentState.RegionBlockList -DifferenceObject $Settings.RegionBlockList.value)))
103+
((-not $CurrentState.RegionBlockList -and -not $Settings.RegionBlockList.value) -or (!(Compare-Object -ReferenceObject $CurrentState.RegionBlockList -DifferenceObject $Settings.RegionBlockList.value))) -and
104+
(!(Compare-Object -ReferenceObject $CurrentState.AllowedSenderDomains -DifferenceObject ($Settings.AllowedSenderDomains.value ?? $Settings.AllowedSenderDomains)))
104105

105106
$AcceptedDomains = New-ExoRequest -TenantId $Tenant -cmdlet 'Get-AcceptedDomain'
106107

@@ -153,6 +154,7 @@ function Invoke-CIPPStandardSpamFilterPolicy {
153154
LanguageBlockList = $Settings.LanguageBlockList.value
154155
EnableRegionBlockList = $Settings.EnableRegionBlockList
155156
RegionBlockList = $Settings.RegionBlockList.value
157+
AllowedSenderDomains = $Settings.AllowedSenderDomains.value ?? @{"@odata.type" = "#Exchange.GenericHashTable"}
156158
}
157159

158160
if ($CurrentState.Name -eq $PolicyName) {

0 commit comments

Comments
 (0)