File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Entrypoints/HTTP Functions/CIPP/Settings Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ function Invoke-ListTenantGroups {
12
12
13
13
$groupFilter = $Request.Query.groupId ?? $Request.Body.groupId
14
14
$TenantGroups = (Get-TenantGroups - GroupId $groupFilter ) ?? @ ()
15
- $SortedTenantGroups = $TenantGroups | Sort-Object Name
16
- $Body = @ { Results = @ ($SortedTenantGroups ) }
15
+ $Body = @ { Results = @ ($TenantGroups ) }
17
16
18
17
Push-OutputBinding - Name Response - Value ([HttpResponseContext ]@ {
19
18
StatusCode = [HttpStatusCode ]::OK
Original file line number Diff line number Diff line change @@ -43,18 +43,21 @@ function Get-TenantGroups {
43
43
}
44
44
45
45
if ($TenantFilter -and $TenantFilter -ne ' allTenants' ) {
46
+ $Results = @ ()
46
47
$Memberships = $AllMembers | Where-Object { $_.customerId -eq $Tenants.customerId }
47
48
foreach ($Group in $Memberships ) {
48
49
$Group = $Groups | Where-Object { $_.RowKey -eq $Group.GroupId }
49
50
if ($Group ) {
50
- [PSCustomObject ]@ {
51
+ $Results += [PSCustomObject ]@ {
51
52
Id = $Group.RowKey
52
53
Name = $Group.Name
53
54
Description = $Group.Description
54
55
}
55
56
}
56
57
}
58
+ return $Results | Sort-Object Name
57
59
} else {
60
+ $Results = @ ()
58
61
$Groups | ForEach-Object {
59
62
$Group = $_
60
63
$Members = $AllMembers | Where-Object { $_.GroupId -eq $Group.RowKey }
@@ -75,14 +78,16 @@ function Get-TenantGroups {
75
78
}
76
79
if (! $Members ) {
77
80
$Members = @ ()
81
+ } else {
82
+ $Members = $Members | Sort-Object displayName
78
83
}
79
-
80
- [PSCustomObject ]@ {
84
+ $Results += [PSCustomObject ]@ {
81
85
Id = $Group.RowKey
82
86
Name = $Group.Name
83
87
Description = $Group.Description
84
88
Members = @ ($Members )
85
89
}
86
90
}
91
+ return $Results | Sort-Object Name
87
92
}
88
93
}
You can’t perform that action at this time.
0 commit comments