mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Check if the groups are there to remove/add
This commit is contained in:
@@ -42,9 +42,11 @@ def update_user_access(user):
|
||||
addgroups = set(chargroups) - set(set(user.groups.all()) & set(corpgroups))
|
||||
|
||||
for g in delgroups:
|
||||
if g in user.groups.all():
|
||||
user.groups.remove(g)
|
||||
|
||||
for g in addgroups:
|
||||
if not g in user.groups.all():
|
||||
user.groups.add(g)
|
||||
|
||||
# For users set to not active, delete all accounts
|
||||
|
||||
Reference in New Issue
Block a user