File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed
Modules/CIPPCore/Public/Webhooks Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -126,13 +126,25 @@ function Test-CIPPAuditLogRules {
126126 $TrustedIPTable = Get-CIPPTable - TableName ' trustedIps'
127127 $ConfigTable = Get-CIPPTable - TableName ' WebhookRules'
128128 $ConfigEntries = Get-CIPPAzDataTableEntity @ConfigTable
129- $Configuration = $ConfigEntries | Where-Object { ($_.Tenants -match $TenantFilter -or $_.Tenants -match ' AllTenants' ) } | ForEach-Object {
130- [pscustomobject ]@ {
131- Tenants = ($_.Tenants | ConvertFrom-Json )
132- Excluded = ($_.excludedTenants | ConvertFrom-Json - ErrorAction SilentlyContinue)
133- Conditions = $_.Conditions
134- Actions = $_.Actions
135- LogType = $_.Type
129+ $Configuration = foreach ($ConfigEntry in $ConfigEntries ) {
130+ if ([string ]::IsNullOrEmpty($ConfigEntry.Tenants )) {
131+ continue
132+ }
133+ $Tenants = $ConfigEntry.Tenants | ConvertFrom-Json - ErrorAction SilentlyContinue
134+ if ($null -eq $Tenants ) {
135+ continue
136+ }
137+ # Expand tenant groups to get actual tenant list
138+ $ExpandedTenants = Expand-CIPPTenantGroups - TenantFilter $Tenants
139+ # Check if the TenantFilter matches any tenant in the expanded list or AllTenants
140+ if ($ExpandedTenants.value -contains $TenantFilter -or $ExpandedTenants.value -contains ' AllTenants' ) {
141+ [pscustomobject ]@ {
142+ Tenants = $Tenants
143+ Excluded = ($ConfigEntry.excludedTenants | ConvertFrom-Json - ErrorAction SilentlyContinue)
144+ Conditions = $ConfigEntry.Conditions
145+ Actions = $ConfigEntry.Actions
146+ LogType = $ConfigEntry.Type
147+ }
136148 }
137149 }
138150
You can’t perform that action at this time.
0 commit comments