Skip to content

Commit 7e5fe3c

Browse files
committed
fix logic for checking existing group membership
1 parent 360dadc commit 7e5fe3c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Tenant/Invoke-EditTenant.ps1

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

3-
Function Invoke-EditTenant {
3+
function Invoke-EditTenant {
44
<#
55
.FUNCTIONALITY
66
Entrypoint,AnyTenant
@@ -46,9 +46,9 @@ Function Invoke-EditTenant {
4646
}
4747

4848
# Update tenant groups
49-
$CurrentMembers = Get-CIPPAzDataTableEntity @GroupMembersTable -Filter "customerId eq '$customerId'"
49+
$CurrentGroupMemberships = Get-CIPPAzDataTableEntity @GroupMembersTable -Filter "customerId eq '$customerId'"
5050
foreach ($Group in $tenantGroups) {
51-
$GroupEntity = $CurrentMembers | Where-Object { $_.GroupId -eq $Group.groupId }
51+
$GroupEntity = $CurrentGroupMemberships | Where-Object { $_.GroupId -eq $Group.groupId }
5252
if (!$GroupEntity) {
5353
$GroupEntity = @{
5454
PartitionKey = 'Member'
@@ -61,8 +61,8 @@ Function Invoke-EditTenant {
6161
}
6262

6363
# Remove any groups that are no longer selected
64-
foreach ($Group in $CurrentMembers) {
65-
if ($tenantGroups -notcontains $Group.GroupId) {
64+
foreach ($Group in $CurrentGroupMemberships) {
65+
if ($tenantGroups.GroupId -notcontains $Group.GroupId) {
6666
Remove-AzDataTableEntity @GroupMembersTable -Entity $Group
6767
}
6868
}

0 commit comments

Comments
 (0)