Skip to content

Commit 8ebf9cc

Browse files
committed
fix transport rules
1 parent 173de70 commit 8ebf9cc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Transport/Invoke-AddTransportRule.ps1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using namespace System.Net
22

3-
Function Invoke-AddTransportRule {
3+
function Invoke-AddTransportRule {
44
<#
55
.FUNCTIONALITY
6-
Entrypoint
6+
Entrypoint,AnyTenant
77
.ROLE
88
Exchange.TransportRule.ReadWrite
99
#>
@@ -17,6 +17,15 @@ Function Invoke-AddTransportRule {
1717
$RequestParams = $Request.Body.PowerShellCommand | ConvertFrom-Json | Select-Object -Property * -ExcludeProperty GUID, HasSenderOverride, ExceptIfHasSenderOverride, ExceptIfMessageContainsDataClassifications, MessageContainsDataClassifications
1818

1919
$Tenants = ($Request.body.selectedTenants).value
20+
21+
$AllowedTenants = Test-CippAccess -Request $Request -TenantList
22+
23+
if ($AllowedTenants -ne 'AllTenants') {
24+
$AllTenants = Get-Tenants -IncludeErrors
25+
$AllowedTenantList = $AllTenants | Where-Object { $_.customerId -in $AllowedTenants }
26+
$Tenants = $Tenants | Where-Object { $_ -in $AllowedTenantList.defaultDomainName }
27+
}
28+
2029
$Result = foreach ($tenantFilter in $tenants) {
2130
$Existing = New-ExoRequest -ErrorAction SilentlyContinue -tenantid $tenantFilter -cmdlet 'Get-TransportRule' -useSystemMailbox $true | Where-Object -Property Identity -EQ $RequestParams.name
2231
try {

0 commit comments

Comments
 (0)