Skip to content

Commit d38fb1c

Browse files
Merge pull request KelvinTegelaar#1633 from kris6673/blocked-endpoint
Fix: Fix null checks and fix CIPP permissions
2 parents ff261e7 + 7f9778c commit d38fb1c

File tree

10 files changed

+18
-19
lines changed

10 files changed

+18
-19
lines changed

Modules/CIPPCore/Public/Authentication/Get-CIPPHttpFunctions.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ function Get-CIPPHttpFunctions {
1818
}
1919

2020
if ($ByRole.IsPresent -or $ByRoleGroup.IsPresent) {
21-
$Results = $Results | Group-Object -Property Role | Select-Object -Property @{l = 'Permission'; e = { $_.Name -eq '' ? 'None' : $_.Name } }, Count, @{l = 'Functions'; e = { $_.Group | Select-Object @{l='Name'; e={$_.Function -replace 'Invoke-'}}, Description } } | Sort-Object -Property Permission
21+
$Results = $Results | Group-Object -Property Role | Select-Object -Property @{l = 'Permission'; e = { $_.Name -eq '' ? 'None' : $_.Name } }, Count, @{l = 'Functions'; e = { $_.Group | Select-Object @{l = 'Name'; e = { $_.Function -replace 'Invoke-' } }, Description } } | Sort-Object -Property Permission
2222
if ($ByRoleGroup.IsPresent) {
2323
$RoleGroup = @{}
2424
foreach ($Permission in $Results) {
2525
$PermSplit = $Permission.Permission -split '\.'
2626
if ($PermSplit.Count -ne 3) { continue }
27-
if ($RoleGroup[$PermSplit[0]] -eq $null) { $RoleGroup[$PermSplit[0]] = @{} }
28-
if ($RoleGroup[$PermSplit[0]][$PermSplit[1]] -eq $null) { $RoleGroup[$PermSplit[0]][$PermSplit[1]] = @{} }
27+
if ($null -eq $RoleGroup[$PermSplit[0]]) { $RoleGroup[$PermSplit[0]] = @{} }
28+
if ($null -eq $RoleGroup[$PermSplit[0]][$PermSplit[1]]) { $RoleGroup[$PermSplit[0]][$PermSplit[1]] = @{} }
2929
$RoleGroup[$PermSplit[0]][$PermSplit[1]][$PermSplit[2]] = @($Permission.Functions)
3030
}
3131
$Results = $RoleGroup

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetCIPPAutoBackup.ps1

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

3-
Function Invoke-ExecSetCIPPAutoBackup {
3+
function Invoke-ExecSetCIPPAutoBackup {
44
<#
55
.FUNCTIONALITY
66
Entrypoint
77
.ROLE
8-
CIPP.Backup.Read
8+
CIPP.Backup.ReadWrite
99
#>
1010
[CmdletBinding()]
1111
param($Request, $TriggerMetadata)

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Resources/Invoke-ListEquipment.ps1

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

3-
Function Invoke-ListEquipment {
3+
function Invoke-ListEquipment {
44
<#
55
.FUNCTIONALITY
66
Entrypoint
77
.ROLE
8-
Exchange.Equipment.ReadWrite
8+
Exchange.Equipment.Read
99
#>
1010
[CmdletBinding()]
1111
param($Request, $TriggerMetadata)

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditAntiPhishingFilter.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function Invoke-EditAntiPhishingFilter {
33
.FUNCTIONALITY
44
Entrypoint
55
.ROLE
6-
Exchange.SpamFilter.Read
6+
Exchange.SpamFilter.ReadWrite
77
#>
88
[CmdletBinding()]
99
param($Request, $TriggerMetadata)
@@ -33,7 +33,7 @@ function Invoke-EditAntiPhishingFilter {
3333
'Disable' {
3434
$ExoRequestParam.Add('cmdlet', 'Disable-AntiPhishRule')
3535
}
36-
Default {
36+
default {
3737
throw 'Invalid state'
3838
}
3939
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditMalwareFilter.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function Invoke-EditMalwareFilter {
33
.FUNCTIONALITY
44
Entrypoint
55
.ROLE
6-
Exchange.SpamFilter.Read
6+
Exchange.SpamFilter.ReadWrite
77
#>
88
[CmdletBinding()]
99
param($Request, $TriggerMetadata)
@@ -33,7 +33,7 @@ function Invoke-EditMalwareFilter {
3333
'Disable' {
3434
$ExoRequestParam.Add('cmdlet', 'Disable-MalwareFilterRule')
3535
}
36-
Default {
36+
default {
3737
throw 'Invalid state'
3838
}
3939
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-EditSafeAttachmentsFilter.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function Invoke-EditSafeAttachmentsFilter {
33
.FUNCTIONALITY
44
Entrypoint
55
.ROLE
6-
Exchange.SpamFilter.Read
6+
Exchange.SpamFilter.ReadWrite
77
#>
88
[CmdletBinding()]
99
param($Request, $TriggerMetadata)
@@ -33,7 +33,7 @@ function Invoke-EditSafeAttachmentsFilter {
3333
'Disable' {
3434
$ExoRequestParam.Add('cmdlet', 'Disable-SafeAttachmentRule')
3535
}
36-
Default {
36+
default {
3737
throw 'Invalid state'
3838
}
3939
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantine.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function Invoke-ListMailQuarantine {
33
.FUNCTIONALITY
44
Entrypoint
55
.ROLE
6-
Exchange.SpamFilter.ReadWrite
6+
Exchange.SpamFilter.Read
77
#>
88
[CmdletBinding()]
99
param($Request, $TriggerMetadata)

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantineMessage.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function Invoke-ListMailQuarantineMessage {
33
.FUNCTIONALITY
44
Entrypoint
55
.ROLE
6-
Exchange.SpamFilter.ReadWrite
6+
Exchange.SpamFilter.Read
77
#>
88
[CmdletBinding()]
99
param($Request, $TriggerMetadata)

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Application Approval/Invoke-ExecAppApproval.ps1

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

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

1717

18-
Write-Host "$($Request.query.ID)"
19-
# Interact with query parameters or the body of the request.
18+
# Seems to be an unused endpoint? -Bobby
2019

2120
$ApplicationId = if ($Request.Query.ApplicationId) { $Request.Query.ApplicationId } else { $env:ApplicationID }
2221
$Results = Get-Tenants | ForEach-Object {

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ExecDomainAnalyser.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function Invoke-ExecDomainAnalyser {
33
.FUNCTIONALITY
44
Entrypoint,AnyTenant
55
.ROLE
6-
Tenant.DomainAnalyser.Read
6+
Tenant.DomainAnalyser.ReadWrite
77
#>
88
[CmdletBinding()]
99
param($Request, $TriggerMetadata)

0 commit comments

Comments
 (0)