Skip to content

Commit 489a32a

Browse files
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into dev
2 parents 1051a2c + 08ade0c commit 489a32a

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,22 @@ function Invoke-CIPPStandardSpoofWarn {
4848

4949
# Test if all entries in the AllowListAdd variable are in the AllowList
5050
$AllowListCorrect = $true
51-
$AllowListAddEntries = foreach ($entry in $AllowListAdd) {
52-
if ($CurrentInfo.AllowList -notcontains $entry) {
53-
$AllowListCorrect = $false
54-
Write-Host "AllowList entry $entry not found in current AllowList"
55-
$entry
56-
} else {
57-
Write-Host "AllowList entry $entry found in current AllowList."
51+
52+
if ($AllowListAdd -eq $null -or $AllowListAdd.Count -eq 0) {
53+
Write-Host 'No AllowList entries provided, skipping AllowList check.'
54+
$AllowListAdd = @{'@odata.type' = '#Exchange.GenericHashTable'; Add = @() }
55+
} else {
56+
$AllowListAddEntries = foreach ($entry in $AllowListAdd) {
57+
if ($CurrentInfo.AllowList -notcontains $entry) {
58+
$AllowListCorrect = $false
59+
Write-Host "AllowList entry $entry not found in current AllowList"
60+
$entry
61+
} else {
62+
Write-Host "AllowList entry $entry found in current AllowList."
63+
}
5864
}
65+
$AllowListAdd = @{'@odata.type' = '#Exchange.GenericHashTable'; Add = $AllowListAddEntries }
5966
}
60-
$AllowListAdd = @{'@odata.type' = '#Exchange.GenericHashTable'; Add = $AllowListAddEntries }
6167

6268
# Debug output
6369
# Write-Host ($CurrentInfo | ConvertTo-Json -Depth 10)

0 commit comments

Comments
 (0)