Skip to content

Commit 3f4ec79

Browse files
authored
Merge pull request #337 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents fd84794 + c737482 commit 3f4ec79

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Tools/Invoke-ExecGraphExplorerPreset.ps1

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ function Invoke-ExecGraphExplorerPreset {
1313
$APIName = $Request.Params.CIPPEndpoint
1414
$Headers = $Request.Headers
1515
Write-LogMessage -headers $Headers -API $APIName -message 'Accessed this API' -Sev 'Debug'
16-
#UNDOREPLACE
1716
$Username = ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Headers.'x-ms-client-principal')) | ConvertFrom-Json).userDetails
1817

19-
$Action = $Request.Body.Action ?? ''
18+
$Action = $Request.Body.action ?? ''
2019

2120
Write-Information ($Request.Body | ConvertTo-Json -Depth 10)
2221

@@ -48,8 +47,10 @@ function Invoke-ExecGraphExplorerPreset {
4847
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
4948
StatusCode = $StatusCode
5049
Body = @{
51-
Results = $Message
52-
Success = $false
50+
Results = @{
51+
resultText = $Message
52+
state = 'error'
53+
}
5354
}
5455
})
5556
return
@@ -61,8 +62,10 @@ function Invoke-ExecGraphExplorerPreset {
6162
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
6263
StatusCode = $StatusCode
6364
Body = @{
64-
Results = $Message
65-
Success = $false
65+
Results = @{
66+
resultText = $Message
67+
state = 'error'
68+
}
6669
}
6770
})
6871
return
@@ -111,8 +114,10 @@ function Invoke-ExecGraphExplorerPreset {
111114
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
112115
StatusCode = $StatusCode
113116
Body = @{
114-
Results = $Message
115-
Success = $Success
117+
Results = @{
118+
resultText = $Message
119+
state = if ($Success) { 'success' } else { 'error' }
120+
}
116121
}
117122
})
118123
}

Modules/CIPPCore/Public/Entrypoints/Invoke-ListGraphExplorerPresets.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ function Invoke-ListGraphExplorerPresets {
1414
$Headers = $Request.Headers
1515
Write-LogMessage -headers $Headers -API $APIName -message 'Accessed this API' -Sev 'Debug'
1616

17-
# Interact with query parameters or the body of the request.
18-
$Username = $Request.Headers['x-ms-client-principal-name']
17+
$Username = ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Headers.'x-ms-client-principal')) | ConvertFrom-Json).userDetails
1918

2019
try {
2120
$Table = Get-CIPPTable -TableName 'GraphPresets'
@@ -26,6 +25,7 @@ function Invoke-ListGraphExplorerPresets {
2625
name = $Preset.name
2726
IsShared = $Preset.IsShared
2827
IsMyPreset = $Preset.Owner -eq $Username
28+
Owner = $Preset.Owner
2929
params = (ConvertFrom-Json -InputObject $Preset.Params)
3030
}
3131
}

0 commit comments

Comments
 (0)