Skip to content

Commit 3e4819b

Browse files
Merge pull request KelvinTegelaar#1906 from Zacgoose/app-consent-request
Fix: Evaluate Global Admin as a default role when no roles are set
2 parents 2ffff54 + b542cb9 commit 3e4819b

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)