Skip to content

Commit a0396c9

Browse files
authored
Merge pull request #407 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 4f72a03 + bc8d038 commit a0396c9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM/Invoke-AddPolicy.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using namespace System.Net
22

3-
Function Invoke-AddPolicy {
3+
function Invoke-AddPolicy {
44
<#
55
.FUNCTIONALITY
66
Entrypoint
@@ -14,8 +14,8 @@ Function Invoke-AddPolicy {
1414
$Headers = $Request.Headers
1515
Write-LogMessage -headers $Headers -API $APIName -message 'Accessed this API' -Sev 'Debug'
1616

17-
$Tenants = ($Request.Body.tenantFilter.value)
18-
if ('AllTenants' -in $Tenants) { $Tenants = (Get-Tenants).defaultDomainName }
17+
$Tenants = $Request.Body.tenantFilter.value ? $Request.Body.tenantFilter.value : $Request.Body.tenantFilter
18+
if ('AllTenants' -in $Tenants) { $Tetnants = (Get-Tenants).defaultDomainName }
1919
$displayname = $Request.Body.displayName
2020
$description = $Request.Body.Description
2121
$AssignTo = if ($Request.Body.AssignTo -ne 'on') { $Request.Body.AssignTo }
@@ -25,7 +25,7 @@ Function Invoke-AddPolicy {
2525

2626
$results = foreach ($Tenant in $tenants) {
2727
if ($Request.Body.replacemap.$tenant) {
28-
([pscustomobject]$Request.Body.replacemap.$tenant).psobject.properties | ForEach-Object { $RawJson = $RawJson -replace $_.name, $_.value }
28+
([pscustomobject]$Request.Body.replacemap.$tenant).psobject.properties | ForEach-Object { $RawJson = $RawJson -replace $_.name, $_.value }
2929
}
3030
try {
3131
Write-Host 'Calling Adding policy'

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tools/GitHub/Invoke-ExecGitHubAction.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function Invoke-ExecGitHubAction {
2323
$SplatParams = $Parameters | Select-Object -ExcludeProperty Action, TenantFilter | ConvertTo-Json | ConvertFrom-Json -AsHashtable
2424

2525
$Table = Get-CIPPTable -TableName Extensionsconfig
26-
$Configuration = ((Get-CIPPAzDataTableEntity @Table).config | ConvertFrom-Json).GitHub
26+
$Configuration = ((Get-CIPPAzDataTableEntity @Table).config | ConvertFrom-Json -ErrorAction SilentlyContinue).GitHub
2727

2828
if (!$Configuration.Enabled) {
2929
$Response = Invoke-RestMethod -Uri 'https://cippy.azurewebsites.net/api/ExecGitHubAction' -Method POST -Body ($Parameters | ConvertTo-Json -Depth 10) -ContentType 'application/json'

0 commit comments

Comments
 (0)