Skip to content

Commit 58ac671

Browse files
committed
Mirror groups should remove any that are not in the claim
1 parent ec1e40d commit 58ac671

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

django_auth_adfs/backend.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,9 @@ def update_user_groups(self, user, claim_groups):
385385
for name in claim_groups
386386
if name not in existing_claimed_group_names
387387
]
388-
# Associate the users to all claimed groups
389-
user.groups.set(
390-
tuple(existing_claimed_groups) + tuple(new_claimed_groups)
391-
)
388+
# Set user's groups to all claimed groups (both existing and
389+
# newly created) and remove any that are not in the claim.
390+
user.groups.set(new_claimed_groups)
392391
else:
393392
# Associate the user to only existing claimed groups
394393
user.groups.set(existing_claimed_groups)

0 commit comments

Comments
 (0)