mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-12 22:10:16 +02:00
Ensure autogroups are removed if new state has config
This commit is contained in:
parent
ef9284030b
commit
ad1fd633b1
@ -38,14 +38,13 @@ class AutogroupsConfigManager(models.Manager):
|
|||||||
"""
|
"""
|
||||||
if state is None:
|
if state is None:
|
||||||
state = user.profile.state
|
state = user.profile.state
|
||||||
configs = self.filter(states=state)
|
for config in self.filter(states=state):
|
||||||
if configs:
|
# grant user new groups for their state
|
||||||
[config.update_group_membership_for_user(user) for config in configs]
|
config.update_group_membership_for_user(user)
|
||||||
else:
|
for config in self.exclude(states=state):
|
||||||
# No config for this user's state. Remove all managed groups.
|
# ensure user does not have groups from previous state
|
||||||
for config in self.all():
|
config.remove_user_from_alliance_groups(user)
|
||||||
config.remove_user_from_alliance_groups(user)
|
config.remove_user_from_corp_groups(user)
|
||||||
config.remove_user_from_corp_groups(user)
|
|
||||||
|
|
||||||
|
|
||||||
class AutogroupsConfig(models.Model):
|
class AutogroupsConfig(models.Model):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user