Skip to content

Commit

Permalink
Merge pull request #5395 from ricmestre/fix5394
Browse files Browse the repository at this point in the history
EXOATPBuiltInProtectionRule, EXOEOPProtectionRule: Fix comparison on empty arrays
  • Loading branch information
NikCharlebois authored Nov 13, 2024
2 parents 1e6fa81 + 3295f38 commit 95317fe
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* Fixed bug where an empty value was passed in the request for the
insiderRiskLevels parameter, which throws an error.
FIXES [#5389](https://github.com/microsoft/Microsoft365DSC/issues/5389)
* EXOATPBuiltInProtectionRule, EXOEOPProtectionRule
* Fixed issue where empty arrays were being compared incorrectly to null
strings
FIXES [#5394](https://github.com/microsoft/Microsoft365DSC/issues/5394)
* IntuneAccountProtectionLocalAdministratorPasswordSolutionPolicy
* Update property `PasswordAgeDays_AAD` to be lower-case.
FIXES [#5378](https://github.com/microsoft/Microsoft365DSC/issues/5378) (1/2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,21 @@ function Test-TargetResource
Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)"
Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $ValuesToCheck)"

foreach ($key in $ValuesToCheck.Keys)
{
if ($null -eq $CurrentValues[$key])
{
switch -regex ($key)
{
"^ExceptIf\w+$"
{
$CurrentValues[$key] = @()
break
}
}
}
}

$testResult = Test-M365DSCParameterState -CurrentValues $CurrentValues `
-Source $($MyInvocation.MyCommand.Source) `
-DesiredValues $PSBoundParameters `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,26 @@ function Test-TargetResource
Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)"
Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $ValuesToCheck)"

#Convert any DateTime to String
foreach ($key in $ValuesToCheck.Keys)
{
# Convert any DateTime to String
if (($null -ne $CurrentValues[$key]) `
-and ($CurrentValues[$key].GetType().Name -eq 'DateTime'))
{
$CurrentValues[$key] = $CurrentValues[$key].toString()
continue
}

if ($null -eq $CurrentValues[$key])
{
switch -regex ($key)
{
"^ExceptIf\w+$|^RecipientDomainIs$|^SentTo(\w+)?$"
{
$CurrentValues[$key] = @()
break
}
}
}
}

Expand Down

0 comments on commit 95317fe

Please sign in to comment.