Skip to content

Commit 7027184

Browse files
committed
fix group issues
1 parent d57feaa commit 7027184

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-AddGroup.ps1

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

3-
Function Invoke-AddGroup {
3+
function Invoke-AddGroup {
44
<#
55
.FUNCTIONALITY
66
Entrypoint
@@ -38,11 +38,11 @@ Function Invoke-AddGroup {
3838
if ($GroupObject.groupType -eq 'm365') {
3939
$BodyParams | Add-Member -NotePropertyName 'groupTypes' -NotePropertyValue @('Unified')
4040
}
41-
if ($GroupObject.owners -AND $GroupObject.groupType -in 'generic', 'azurerole', 'security') {
41+
if ($GroupObject.owners) {
4242
$BodyParams | Add-Member -NotePropertyName '[email protected]' -NotePropertyValue (($GroupObject.owners) | ForEach-Object { "https://graph.microsoft.com/v1.0/users/$($_.value)" })
4343
$BodyParams.'[email protected]' = @($BodyParams.'[email protected]')
4444
}
45-
if ($GroupObject.members -AND $GroupObject.groupType -in 'generic', 'azurerole', 'security') {
45+
if ($GroupObject.members) {
4646
$BodyParams | Add-Member -NotePropertyName '[email protected]' -NotePropertyValue (($GroupObject.members) | ForEach-Object { "https://graph.microsoft.com/v1.0/users/$($_.value)" })
4747
$BodyParams.'[email protected]' = @($BodyParams.'[email protected]')
4848
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroups.ps1

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

3-
Function Invoke-ListGroups {
3+
function Invoke-ListGroups {
44
<#
55
.FUNCTIONALITY
66
Entrypoint
@@ -95,18 +95,16 @@ Function Invoke-ListGroups {
9595
} else {
9696
$GraphRequest = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/groups/$($GroupID)/$($members)?`$top=999&select=$selectstring" -tenantid $TenantFilter | Select-Object *, @{ Name = 'primDomain'; Expression = { $_.mail -split '@' | Select-Object -Last 1 } },
9797
@{Name = 'membersCsv'; Expression = { $_.members.userPrincipalName -join ',' } },
98-
@{Name = 'teamsEnabled'; Expression = { if ($_.resourceProvisioningOptions -Like '*Team*') { $true }else { $false } } },
98+
@{Name = 'teamsEnabled'; Expression = { if ($_.resourceProvisioningOptions -like '*Team*') { $true }else { $false } } },
9999
@{Name = 'calculatedGroupType'; Expression = {
100-
101-
if ($_.mailEnabled -and $_.securityEnabled) {
100+
if ($_.groupTypes -contains 'Unified') {
101+
'Microsoft 365'
102+
} elseif ($_.mailEnabled -and $_.securityEnabled) {
102103
'Mail-Enabled Security'
103104
}
104105
if (!$_.mailEnabled -and $_.securityEnabled) {
105106
'Security'
106107
}
107-
if ($_.groupTypes -contains 'Unified') {
108-
'Microsoft 365'
109-
}
110108
if (([string]::isNullOrEmpty($_.groupTypes)) -and ($_.mailEnabled) -and (!$_.securityEnabled)) {
111109
'Distribution List'
112110
}

0 commit comments

Comments
 (0)