mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-15 07:12: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))
|
addgroups = set(chargroups) - set(set(user.groups.all()) & set(corpgroups))
|
||||||
|
|
||||||
for g in delgroups:
|
for g in delgroups:
|
||||||
|
if g in user.groups.all():
|
||||||
user.groups.remove(g)
|
user.groups.remove(g)
|
||||||
|
|
||||||
for g in addgroups:
|
for g in addgroups:
|
||||||
|
if not g in user.groups.all():
|
||||||
user.groups.add(g)
|
user.groups.add(g)
|
||||||
|
|
||||||
# For users set to not active, delete all accounts
|
# For users set to not active, delete all accounts
|
||||||
|
|||||||
Reference in New Issue
Block a user