File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Modules/CIPPCore/Public/Entrypoints Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,8 @@ Function Invoke-ListGraphExplorerPresets {
12
12
13
13
$APIName = $TriggerMetadata.FunctionName
14
14
Write-LogMessage - user $request.headers .' x-ms-client-principal' - API $APINAME - message ' Accessed this API' - Sev ' Debug'
15
-
16
15
$Username = ([System.Text.Encoding ]::UTF8.GetString([System.Convert ]::FromBase64String($request.headers .' x-ms-client-principal' )) | ConvertFrom-Json ).userDetails
17
- # Write to the Azure Functions log stream.
18
- Write-Host ' PowerShell HTTP trigger function processed a request.'
16
+
19
17
try {
20
18
$Table = Get-CIPPTable - TableName ' GraphPresets'
21
19
$Presets = Get-CIPPAzDataTableEntity @Table - Filter " Owner eq '$Username ' or IsShared eq true" | Sort-Object - Property name
@@ -28,16 +26,21 @@ Function Invoke-ListGraphExplorerPresets {
28
26
params = ConvertFrom-Json - InputObject $Preset.Params
29
27
}
30
28
}
29
+
30
+ if ($Request.Query.Endpoint ) {
31
+ $Endpoint = $Request.Query.Endpoint -replace ' ^/' , ' '
32
+ $Results = $Results | Where-Object { $_.params.endpoint -eq $Endpoint }
33
+ }
31
34
} catch {
32
- $Presets = @ ()
35
+ $Results = @ ()
33
36
}
34
37
# Associate values to output bindings by calling 'Push-OutputBinding'.
35
38
Push-OutputBinding - Name Response - Value ([HttpResponseContext ]@ {
36
39
StatusCode = [HttpStatusCode ]::OK
37
40
Body = @ {
38
41
Results = @ ($Results )
39
42
Metadata = @ {
40
- Count = ($Presets | Measure-Object ).Count
43
+ Count = ($Results | Measure-Object ).Count
41
44
}
42
45
}
43
46
})
You can’t perform that action at this time.
0 commit comments