Skip to content

Commit ebae198

Browse files
committed
fix: scheduled tasks with limited tenant list
1 parent e687195 commit ebae198

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItems.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ Function Invoke-ListScheduledItems {
4949
}
5050

5151
$AllowedTenants = Test-CIPPAccess -Request $Request -TenantList
52+
5253
if ($AllowedTenants -notcontains 'AllTenants') {
53-
$Tasks = $Tasks | Where-Object -Property TenantId -In $AllowedTenants
54+
$TenantList = Get-Tenants -IncludeErrors | Select-Object customerId, defaultDomainName
55+
$AllowedTenantDomains = $TenantList | Where-Object -Property customerId -In $AllowedTenants | Select-Object -ExpandProperty defaultDomainName
56+
$Tasks = $Tasks | Where-Object -Property Tenant -In $AllowedTenantDomains
5457
}
5558
$ScheduledTasks = foreach ($Task in $tasks) {
5659
if ($Task.Parameters) {

0 commit comments

Comments
 (0)