File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed
Entrypoints/HTTP Functions/CIPP/Settings Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -334,6 +334,13 @@ function Invoke-ExecCustomData {
334
334
}
335
335
}
336
336
}
337
+ ' ListAvailableAttributes' {
338
+ $TargetObject = $Request.Query.targetObject ?? ' All'
339
+ $AvailableAttributes = Get-CippCustomDataAttributes - TargetObject $TargetObject
340
+ $Body = @ {
341
+ Results = @ ($AvailableAttributes )
342
+ }
343
+ }
337
344
default {
338
345
$Body = @ {
339
346
Results = @ (
Original file line number Diff line number Diff line change
1
+ function Get-CippCustomDataAttributes {
2
+ <#
3
+ . SYNOPSIS
4
+ Get the custom data attributes for CIPP
5
+ . DESCRIPTION
6
+ This function is used to get the custom data attributes for CIPP
7
+ #>
8
+ [CmdletBinding ()]
9
+ param (
10
+ $TargetObject = ' All'
11
+ )
12
+ $CustomDataTable = Get-CippTable - tablename ' CustomData'
13
+ $CustomDataEntities = Get-CIPPAzDataTableEntity @CustomDataTable
14
+ $AvailableAttributes = foreach ($CustomDataEntity in $CustomDataEntities ) {
15
+ $Type = $CustomDataEntity.PartitionKey
16
+ $CustomData = $CustomDataEntity.JSON | ConvertFrom-Json
17
+ if ($CustomData ) {
18
+ if ($Type -eq ' SchemaExtension' ) {
19
+ $Name = $CustomData.id
20
+ foreach ($TargetObject in $CustomData.targetTypes ) {
21
+ [PSCustomObject ]@ {
22
+ name = $Name
23
+ targetObject = $TargetObject.ToLower ()
24
+ properties = $CustomData.properties
25
+ }
26
+ }
27
+ } elseif ($Type -eq ' DirectoryExtension' ) {
28
+ $Name = $CustomData.RowKey
29
+ foreach ($TargetObject in $CustomData.targetObjects ) {
30
+ [PSCustomObject ]@ {
31
+ name = $Name
32
+ targetObject = $TargetObject
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ if ($TargetObject -eq ' All' ) {
40
+ return $AvailableAttributes
41
+ } else {
42
+ return $AvailableAttributes | Where-Object { $_.targetObject -eq $TargetObject }
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments