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 {
1212
1313 $groupFilter = $Request.Query.groupId ?? $Request.Body.groupId
1414 $TenantGroups = (Get-TenantGroups - GroupId $groupFilter ) ?? @ ()
15- $SortedTenantGroups = $TenantGroups | Sort-Object Name
16- $Body = @ { Results = @ ($SortedTenantGroups ) }
15+ $Body = @ { Results = @ ($TenantGroups ) }
1716
1817 Push-OutputBinding - Name Response - Value ([HttpResponseContext ]@ {
1918 StatusCode = [HttpStatusCode ]::OK
Original file line number Diff line number Diff line change @@ -43,18 +43,21 @@ function Get-TenantGroups {
4343 }
4444
4545 if ($TenantFilter -and $TenantFilter -ne ' allTenants' ) {
46+ $Results = @ ()
4647 $Memberships = $AllMembers | Where-Object { $_.customerId -eq $Tenants.customerId }
4748 foreach ($Group in $Memberships ) {
4849 $Group = $Groups | Where-Object { $_.RowKey -eq $Group.GroupId }
4950 if ($Group ) {
50- [PSCustomObject ]@ {
51+ $Results += [PSCustomObject ]@ {
5152 Id = $Group.RowKey
5253 Name = $Group.Name
5354 Description = $Group.Description
5455 }
5556 }
5657 }
58+ return $Results | Sort-Object Name
5759 } else {
60+ $Results = @ ()
5861 $Groups | ForEach-Object {
5962 $Group = $_
6063 $Members = $AllMembers | Where-Object { $_.GroupId -eq $Group.RowKey }
@@ -75,14 +78,16 @@ function Get-TenantGroups {
7578 }
7679 if (! $Members ) {
7780 $Members = @ ()
81+ } else {
82+ $Members = $Members | Sort-Object displayName
7883 }
79-
80- [PSCustomObject ]@ {
84+ $Results += [PSCustomObject ]@ {
8185 Id = $Group.RowKey
8286 Name = $Group.Name
8387 Description = $Group.Description
8488 Members = @ ($Members )
8589 }
8690 }
91+ return $Results | Sort-Object Name
8792 }
8893}
You can’t perform that action at this time.
0 commit comments