Skip to content

Commit f95cfc5

Browse files
committed
Fix: Fix tablefilter
1 parent 17c489e commit f95cfc5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Invoke-ListAppConsentRequests.ps1

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function Invoke-ListAppConsentRequests {
2222
}
2323

2424
$appConsentRequests = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/identityGovernance/appConsent/appConsentRequests' -tenantid $TenantFilter # Need the beta endpoint to get consentType
25-
$Results = foreach ($app in $appConsentRequests) {
25+
$AllResults = foreach ($app in $appConsentRequests) {
2626
$userConsentRequests = New-GraphGetRequest -Uri "https://graph.microsoft.com/v1.0/identityGovernance/appConsent/appConsentRequests/$($app.id)/userConsentRequests" -tenantid $TenantFilter
2727
$userConsentRequests | ForEach-Object {
2828
[pscustomobject]@{
@@ -48,6 +48,21 @@ function Invoke-ListAppConsentRequests {
4848
}
4949
}
5050
}
51+
52+
# Apply filtering if requested
53+
if ($Request.Query.Filter -eq $true) {
54+
Write-Host 'Applying filters to app consent requests'
55+
$RequestStatus = $Request.Query.RequestStatus
56+
57+
if ($RequestStatus) {
58+
Write-Host "Filtering by RequestStatus: $RequestStatus"
59+
$Results = $AllResults | Where-Object { $_.requestStatus -eq $RequestStatus }
60+
} else {
61+
$Results = $AllResults
62+
}
63+
} else {
64+
$Results = $AllResults
65+
}
5166
$StatusCode = [HttpStatusCode]::OK
5267
} catch {
5368
$ErrorMessage = Get-CippException -Exception $_

0 commit comments

Comments
 (0)