Skip to content

Commit b542cb9

Browse files
committed
Fix: Evaluate Global Admin as a default role when no roles are set
Fixes an issue only with reporting where when no roles are selected GA is added but this is not also handled in the reporting block, only in the remediate block
1 parent ff2e443 commit b542cb9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardEnableAppConsentRequests.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,19 @@ function Invoke-CIPPStandardEnableAppConsentRequests {
119119
}
120120
}
121121
if ($Settings.report -eq $true) {
122+
# Set default if no roles are selected, matches remediation logic
123+
$RolesToAdd = $Settings.ReviewerRoles.value
124+
if (!$RolesToAdd -or $RolesToAdd.Count -eq 0) {
125+
$RolesToAdd = @('62e90394-69f5-4237-9190-012177145e10')
126+
}
122127

123128
$CurrentValue = [PSCustomObject]@{
124129
EnableAppConsentRequests = [bool]$CurrentInfo.isEnabled
125130
ReviewerCount = $CurrentInfo.reviewers.count
126131
}
127132
$ExpectedValue = [PSCustomObject]@{
128133
EnableAppConsentRequests = $true
129-
ReviewerCount = ($Settings.ReviewerRoles.value).count
134+
ReviewerCount = $RolesToAdd.Count
130135
}
131136

132137
Set-CIPPStandardsCompareField -FieldName 'standards.EnableAppConsentRequests' -CurrentValue $CurrentValue -ExpectedValue $ExpectedValue -TenantFilter $Tenant

0 commit comments

Comments
 (0)