@@ -21,27 +21,6 @@ function Invoke-ListFunctionParameters {
2121 $CommonParameters = @ (' Verbose' , ' Debug' , ' ErrorAction' , ' WarningAction' , ' InformationAction' , ' ErrorVariable' , ' WarningVariable' , ' InformationVariable' , ' OutVariable' , ' OutBuffer' , ' PipelineVariable' , ' TenantFilter' , ' APIName' , ' Headers' , ' ProgressAction' , ' WhatIf' , ' Confirm' , ' Headers' , ' NoAuthCheck' )
2222 $TemporaryBlacklist = ' Get-CIPPAuthentication' , ' Invoke-CippWebhookProcessing' , ' Invoke-ListFunctionParameters' , ' New-CIPPAPIConfig' , ' New-CIPPGraphSubscription'
2323 try {
24- # Load permissions from cache
25- if (-not $global :CIPPFunctionPermissions ) {
26- $CIPPCoreModule = Get-Module - Name CIPPCore
27- if ($CIPPCoreModule ) {
28- $PermissionsFileJson = Join-Path $CIPPCoreModule.ModuleBase ' lib' ' data' ' function-permissions.json'
29-
30- if (Test-Path $PermissionsFileJson ) {
31- try {
32- $jsonData = Get-Content - Path $PermissionsFileJson - Raw | ConvertFrom-Json - AsHashtable
33- $global :CIPPFunctionPermissions = [System.Collections.Hashtable ]::new([StringComparer ]::OrdinalIgnoreCase)
34- foreach ($key in $jsonData.Keys ) {
35- $global :CIPPFunctionPermissions [$key ] = $jsonData [$key ]
36- }
37- Write-Information " Loaded $ ( $global :CIPPFunctionPermissions.Count ) function permissions from JSON cache"
38- } catch {
39- Write-Warning " Failed to load function permissions from JSON: $ ( $_.Exception.Message ) "
40- }
41- }
42- }
43- }
44-
4524 if ($Module -eq ' ExchangeOnlineManagement' ) {
4625 $ExoRequest = @ {
4726 AvailableCmdlets = $true
@@ -57,27 +36,17 @@ function Invoke-ListFunctionParameters {
5736 $Functions = Get-Command @CommandQuery | Where-Object { $_.Visibility -eq ' Public' }
5837 }
5938 $Results = foreach ($Function in $Functions ) {
60- if ($Function -In $TemporaryBlacklist ) { continue }
61- $FunctionName = $Function.Name
62- if ($Module -ne ' ExchangeOnlineManagement' -and $global :CIPPFunctionPermissions -and $global :CIPPFunctionPermissions.ContainsKey ($FunctionName )) {
63- $PermissionData = $global :CIPPFunctionPermissions [$FunctionName ]
64- $Functionality = $PermissionData [' Functionality' ]
65- $Synopsis = $PermissionData [' Description' ]
66- } else {
67- $GetHelp = @ {
68- Name = $Function
69- }
70- if ($Module -eq ' ExchangeOnlineManagement' ) {
71- $GetHelp.Path = ' ExchangeOnlineHelp'
72- }
73- $Help = Get-Help @GetHelp
74- $Functionality = $Help.Functionality
75- $Synopsis = $Help.Synopsis
39+ if ($Function -in $TemporaryBlacklist ) { continue }
40+ $GetHelp = @ {
41+ Name = $Function
42+ }
43+ if ($Module -eq ' ExchangeOnlineManagement' ) {
44+ $GetHelp.Path = ' ExchangeOnlineHelp'
7645 }
77-
78- $ParamsHelp = @ ()
79- if ($Functionality -in $IgnoreList ) { continue }
80- if ($Functionality -match ' Entrypoint' ) { continue }
46+ $Help = Get-Help @GetHelp
47+ $ParamsHelp = ( $Help | Select-Object - ExpandProperty parameters).parameter | Select-Object name , @ { n = ' description ' ; exp = { $_ .description.Text } }
48+ if ($Help . Functionality -in $IgnoreList ) { continue }
49+ if ($Help . Functionality -match ' Entrypoint' ) { continue }
8150 $Parameters = foreach ($Key in $Function.Parameters.Keys ) {
8251 if ($CommonParameters -notcontains $Key ) {
8352 $Param = $Function.Parameters .$Key
@@ -103,8 +72,8 @@ function Invoke-ListFunctionParameters {
10372 $StatusCode = [HttpStatusCode ]::BadRequest
10473 }
10574 return [HttpResponseContext ]@ {
106- StatusCode = $StatusCode
107- Body = @ ($Results )
108- }
75+ StatusCode = $StatusCode
76+ Body = @ ($Results )
77+ }
10978
11079}
0 commit comments