Commit 90af6188 authored by Luko van der Maas's avatar Luko van der Maas

Merge branch 'fix/gsuite-sync-issues' into 'master'

Fix small issues with G Suite member sync

See merge request !1436

(cherry picked from commit 129ca8b4)

f9708da7 Fix small issues with G Suite member sync
parent 3e6bb31f
......@@ -16,7 +16,7 @@ class Command(BaseCommand):
def handle(self, *args, **options):
"""Sync all accounts """
for member in Member.active_members.all():
for member in Member.objects.filter(is_staff=True):
try:
email, password = sync_service.create_user(member)
emails.send_gsuite_welcome_message(member, email, password)
......
......@@ -23,7 +23,9 @@ def pre_member_save(instance, **kwargs):
if not settings.GSUITE_MEMBERS_AUTOSYNC:
return
existing_member = Member.objects.get(pk=instance.pk)
existing_member = Member.objects.filter(pk=instance.pk).first()
if not existing_member:
return
try:
if not existing_member.is_staff and instance.is_staff:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment