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,10 +42,12 @@ 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:
|
||||||
user.groups.remove(g)
|
if g in user.groups.all():
|
||||||
|
user.groups.remove(g)
|
||||||
|
|
||||||
for g in addgroups:
|
for g in addgroups:
|
||||||
user.groups.add(g)
|
if not g in user.groups.all():
|
||||||
|
user.groups.add(g)
|
||||||
|
|
||||||
# For users set to not active, delete all accounts
|
# For users set to not active, delete all accounts
|
||||||
if not user.is_active:
|
if not user.is_active:
|
||||||
|
|||||||
Reference in New Issue
Block a user