Skip to content

Commit

Permalink
Only check for Alumnus
Browse files Browse the repository at this point in the history
  • Loading branch information
Bates committed Apr 20, 2024
1 parent c51f673 commit d169644
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions groupassign/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ def state_change(sender, instance, raw, using, update_fields, **kwargs):
if instance.pk:
old_instance = UserProfile.objects.get(pk=instance.pk)
if old_instance.state != instance.state:
if old_instance.state.name == "Member":
logger.debug("Uni State changed from member: Checking for Groups")
group_lists = StateGroupBinding.objects.get(state=instance.state).groups.all()
for grp in group_lists:
if grp not in instance.user.groups.all():
group_lists = StateGroupBinding.objects.get(state=instance.state).groups.all()
for grp in group_lists:
if grp not in instance.user.groups.all():
if grp.name == "Alumnus":
if old_instance.state.name == "Member":
logger.debug("Uni State changed from member: Checking for Groups")
instance.user.groups.add(grp)
else:
logger.debug("Uni State changed from other: Checking for Groups")
instance.user.groups.add(grp)
except ObjectDoesNotExist as e:
pass # no config for this state so skip.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name='allianceauth-group-assigner',
version='0.0.1+euni0.1',
version='0.0.1+euni0.2',
packages=find_packages(),
include_package_data=True,
license='GNU General Public License v3 (GPLv3)',
Expand Down

0 comments on commit d169644

Please sign in to comment.