From b9b3a58f85915a38fe38d7397fcda71fc5df719b Mon Sep 17 00:00:00 2001 From: Bobby <31723128+kris6673@users.noreply.github.com> Date: Wed, 14 Oct 2026 13:00:37 +0200 Subject: [PATCH] fix: read tenantFilter from body on spam filter, backup and exclude-tenant endpoints - EditSpamFilter read tenantFilter from the query only; CippApiDialog sends it in the POST body, so enable/disable failed - EditSpamFilter: State fell back on itself ($State ?? ...) and was always null from query - RemoveSpamfilter fell back Query ?? Query; second operand is now Body - ExecListBackup: add body fallback for tenantFilter - ExecExcludeTenant: name the resolved tenants in the result and log instead of an unset query value --- .../HTTP Functions/CIPP/Core/Invoke-ExecListBackup.ps1 | 2 +- .../HTTP Functions/CIPP/Settings/Invoke-ExecExcludeTenant.ps1 | 4 +++- .../Email-Exchange/Spamfilter/Invoke-EditSpamFilter.ps1 | 4 ++-- .../Email-Exchange/Spamfilter/Invoke-RemoveSpamfilter.ps1 | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecListBackup.ps1 b/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecListBackup.ps1 index 02e8b65272..351f3cb31e 100644 --- a/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecListBackup.ps1 +++ b/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecListBackup.ps1 @@ -10,7 +10,7 @@ function Invoke-ExecListBackup { [CmdletBinding()] param($Request, $TriggerMetadata) $Type = $Request.Query.Type - $TenantFilter = $Request.Query.tenantFilter + $TenantFilter = $Request.Query.tenantFilter ?? $Request.Body.tenantFilter $NameOnly = $Request.Query.NameOnly -eq $true $BackupName = $Request.Query.BackupName diff --git a/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeTenant.ps1 b/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeTenant.ps1 index f8d95351d9..3dd8e4c041 100644 --- a/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeTenant.ps1 +++ b/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecExcludeTenant.ps1 @@ -34,6 +34,7 @@ Function Invoke-ExecExcludeTenant { $Name = $Request.Query.tenantFilter if ($Request.Query.AddExclusion) { $Tenants = Get-Tenants -IncludeAll | Where-Object { $Request.body.value -contains $_.customerId } + $Name = $Tenants.defaultDomainName -join ',' $Excluded = foreach ($Tenant in $Tenants) { $Tenant.Excluded = $true @@ -48,13 +49,14 @@ Function Invoke-ExecExcludeTenant { if ($Request.Query.RemoveExclusion) { $Tenants = Get-Tenants -IncludeAll | Where-Object { $Request.body.value -contains $_.customerId } + $Name = $Tenants.defaultDomainName -join ',' foreach ($Tenant in $Tenants) { $Tenant.Excluded = $false $Tenant.ExcludeUser = '' $Tenant.ExcludeDate = '' Update-AzDataTableEntity -Force @TenantsTable -Entity $Tenant } - Write-LogMessage -API $APIName -tenant $($Name) -headers $Headers -message "Removed exclusion for customer $($Name)" -Sev 'Info' + Write-LogMessage -API $APIName -tenant $($Name) -headers $Headers -message "Removed exclusion for customer(s): $($Name)" -Sev 'Info' $body = [pscustomobject]@{'Results' = "Success. We've removed $Name from the excluded tenants." } } } catch { diff --git a/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSpamFilter.ps1 b/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSpamFilter.ps1 index ed72146bff..edcbbbec4c 100644 --- a/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSpamFilter.ps1 +++ b/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSpamFilter.ps1 @@ -9,9 +9,9 @@ Function Invoke-EditSpamFilter { param($Request, $TriggerMetadata) $APIName = $Request.Params.CIPPEndpoint - $TenantFilter = $request.Query.tenantFilter + $TenantFilter = $Request.Query.tenantFilter ?? $Request.Body.tenantFilter $Name = $Request.Query.name ?? $Request.Body.name - $State = $State ?? $Request.Body.state + $State = $Request.Query.State ?? $Request.Body.State try { $Params = @{ diff --git a/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilter.ps1 b/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilter.ps1 index 2139a1995c..c9baed996b 100644 --- a/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilter.ps1 +++ b/backend/Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-RemoveSpamfilter.ps1 @@ -11,7 +11,7 @@ Function Invoke-RemoveSpamfilter { $APIName = $Request.Params.CIPPEndpoint $Headers = $Request.Headers - $TenantFilter = $Request.Query.tenantFilter ?? $Request.Query.tenantFilter + $TenantFilter = $Request.Query.tenantFilter ?? $Request.Body.tenantFilter $Name = $Request.Query.name ?? $Request.Body.name