We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
G Suite group syncer does not respect group syncer whitelist
## What kind of an issue is this?

- [x] Bug report

## What is the expected behaviour?

If a group is not in the OW4_GSUITE_SETTINGS groups list, it should not be affected by changes to the group.

## What is the current behaviour?

If a group membership is changed, the group is synced, and people will be removed from the group if not using their online mail.


## How do you reproduce this problem? 

Add or remove a person to a group not set up for G Suite syncing (in settings)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `apps/gsuite/mail_syncer/main.py`
Content:
```
1 import logging
2 
3 from apps.gsuite.mail_syncer.utils import (get_excess_groups_for_user, get_excess_users_in_g_suite,
4                                            get_g_suite_users_for_group,
5                                            get_missing_g_suite_group_names_for_user,
6                                            get_missing_ow4_users_for_g_suite,
7                                            get_ow4_users_for_group,
8                                            insert_ow4_user_into_g_suite_group,
9                                            remove_g_suite_user_from_group)
10 
11 logger = logging.getLogger(__name__)
12 
13 
14 def insert_ow4_users_into_g_suite(domain, group_name, missing_users, suppress_http_errors=False):
15     """
16     Inserts a list of OW4 users into a G Suite group.
17     :param domain: The domain in which to insert a user into a group.
18     :type domain: str
19     :param group_name: The name of the group to insert the user into.
20     :type group_name: str
21     :param missing_users: A list of the missing users to be inserted into said group.
22     :type missing_users: list
23     """
24     for missing_user in missing_users:
25         insert_ow4_user_into_g_suite_group(domain, group_name, missing_user, suppress_http_errors=suppress_http_errors)
26 
27 
28 def remove_excess_g_suite_users(domain, group_name, g_suite_excess_users, suppress_http_errors=False):
29     """
30     Removes excess users from a G Suite group.
31     :param domain: The domain in which to remove a user from a group.
32     :type domain: str
33     :param group_name: The name of the group to remove the users from.
34     :type group_name: str
35     :param g_suite_excess_users: A list of the excess users to be removed from said group.
36     :type g_suite_excess_users: list
37     """
38     logger.info("Cleaning G Suite group '{group}'.".format(group=group_name),
39                 extra={'group': group_name, 'excess_users': g_suite_excess_users})
40 
41     for excess_user in g_suite_excess_users:
42         resp = remove_g_suite_user_from_group(domain, group_name, excess_user,
43                                               suppress_http_errors=suppress_http_errors)
44         logger.debug('Response from cleaning {group_name}: {resp}'.format(group_name=group_name, resp=resp))
45 
46 
47 def insert_ow4_user_into_groups(domain, user, group_names, suppress_http_errors=False):
48     """
49     Inserts a single OW4 user into a G Suite group.
50     :param domain: The domain in which to insert a user into a group.
51     :type domain: str
52     :param user: The user to update group memberships for.
53     :type user: apps.authentication.models.OnlineUser
54     :param group_names: A list of group names to insert the user into.
55     :type group_names: list
56     :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.
57     :type suppress_http_errors: bool
58     """
59     groups = ["{group}@{domain}".format(group=group_name, domain=domain) for group_name in group_names]
60     if groups:
61         logger.info('Inserting {user} into some new G Suite groups.'.format(user=user),
62                     extra={'new_groups': group_names, 'user': user})
63     for group in groups:
64         insert_ow4_user_into_g_suite_group(domain, group, user, suppress_http_errors=suppress_http_errors)
65 
66 
67 def cleanup_groups_for_user(domain, user, suppress_http_errors=False):
68     """
69     Finds excess groups for a OW4 user, and removes the user from said groups.
70     :param domain: The domain in which to find a users excess group memberships.
71     :type domain: str
72     :param user: The user to remove excess group memberships for.
73     :type user: apps.authentication.models.OnlineUser
74     :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.
75     :type suppress_http_errors: bool
76     """
77     excess_groups = get_excess_groups_for_user(domain, user)
78     if excess_groups:
79         logger.debug('Removing "{user}" from some G Suite groups.'.format(user=user),
80                      extra={'user': user, 'excess_groups': excess_groups})
81     for group in excess_groups:
82         remove_g_suite_user_from_group(domain, group, user.online_mail, suppress_http_errors=suppress_http_errors)
83 
84 
85 def update_g_suite_user(domain, ow4_user, suppress_http_errors=False):
86     """
87     Finds missing and excess groups and adds and removes the user to/from them, respectively.
88     :param domain: The domain in which to update a users group memberships.
89     :type domain: str
90     :param ow4_user: The user to update group memberships for.
91     :type ow4_user: apps.authentication.models.OnlineUser
92     :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.
93     :type suppress_http_errors: bool
94     """
95     cleanup_groups_for_user(domain, ow4_user, suppress_http_errors=suppress_http_errors)
96     insert_ow4_user_into_groups(domain, ow4_user, get_missing_g_suite_group_names_for_user(domain, ow4_user),
97                                 suppress_http_errors=suppress_http_errors)
98 
99 
100 def update_g_suite_group(domain, group_name, suppress_http_errors=False):
101     """
102     Finds missing and excess users and adds and removes the users to/from them, respectively.
103     :param domain: The domain in which to find a group's user lists.
104     :type domain: str
105     :param group_name: The name of the group to get group membership status for.
106     :type group_name: str
107     :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.
108     :type suppress_http_errors: bool
109     """
110     g_suite_users = get_g_suite_users_for_group(domain, group_name, suppress_http_errors=suppress_http_errors)
111     ow4_users = get_ow4_users_for_group(group_name)
112 
113     excess_users = get_excess_users_in_g_suite(g_suite_users, ow4_users)
114     missing_users = get_missing_ow4_users_for_g_suite(g_suite_users, ow4_users)
115 
116     # @ToDo: Look into bulk updates
117     insert_ow4_users_into_g_suite(domain, group_name, missing_users, suppress_http_errors=suppress_http_errors)
118     remove_excess_g_suite_users(domain, group_name, excess_users, suppress_http_errors=suppress_http_errors)
119
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/apps/gsuite/mail_syncer/main.py b/apps/gsuite/mail_syncer/main.py
--- a/apps/gsuite/mail_syncer/main.py
+++ b/apps/gsuite/mail_syncer/main.py
@@ -1,5 +1,7 @@
 import logging
 
+from django.conf import settings
+
 from apps.gsuite.mail_syncer.utils import (get_excess_groups_for_user, get_excess_users_in_g_suite,
                                            get_g_suite_users_for_group,
                                            get_missing_g_suite_group_names_for_user,
@@ -107,6 +109,12 @@
     :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.
     :type suppress_http_errors: bool
     """
+
+    if group_name.lower() not in settings.OW4_GSUITE_SYNC.get('GROUPS', {}).keys():
+        logger.debug('Not running group syncer for group {} - group syncing not enabled for this group'
+                     .format(group_name))
+        return
+
     g_suite_users = get_g_suite_users_for_group(domain, group_name, suppress_http_errors=suppress_http_errors)
     ow4_users = get_ow4_users_for_group(group_name)

{"golden_diff": "diff --git a/apps/gsuite/mail_syncer/main.py b/apps/gsuite/mail_syncer/main.py\n--- a/apps/gsuite/mail_syncer/main.py\n+++ b/apps/gsuite/mail_syncer/main.py\n@@ -1,5 +1,7 @@\n import logging\n \n+from django.conf import settings\n+\n from apps.gsuite.mail_syncer.utils import (get_excess_groups_for_user, get_excess_users_in_g_suite,\n                                            get_g_suite_users_for_group,\n                                            get_missing_g_suite_group_names_for_user,\n@@ -107,6 +109,12 @@\n     :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.\n     :type suppress_http_errors: bool\n     \"\"\"\n+\n+    if group_name.lower() not in settings.OW4_GSUITE_SYNC.get('GROUPS', {}).keys():\n+        logger.debug('Not running group syncer for group {} - group syncing not enabled for this group'\n+                     .format(group_name))\n+        return\n+\n     g_suite_users = get_g_suite_users_for_group(domain, group_name, suppress_http_errors=suppress_http_errors)\n     ow4_users = get_ow4_users_for_group(group_name)\n", "issue": "G Suite group syncer does not respect group syncer whitelist\n## What kind of an issue is this?\r\n\r\n- [x] Bug report\r\n\r\n## What is the expected behaviour?\r\n\r\nIf a group is not in the OW4_GSUITE_SETTINGS groups list, it should not be affected by changes to the group.\r\n\r\n## What is the current behaviour?\r\n\r\nIf a group membership is changed, the group is synced, and people will be removed from the group if not using their online mail.\r\n\r\n\r\n## How do you reproduce this problem? \r\n\r\nAdd or remove a person to a group not set up for G Suite syncing (in settings)\r\n\n", "before_files": [{"content": "import logging\n\nfrom apps.gsuite.mail_syncer.utils import (get_excess_groups_for_user, get_excess_users_in_g_suite,\n                                           get_g_suite_users_for_group,\n                                           get_missing_g_suite_group_names_for_user,\n                                           get_missing_ow4_users_for_g_suite,\n                                           get_ow4_users_for_group,\n                                           insert_ow4_user_into_g_suite_group,\n                                           remove_g_suite_user_from_group)\n\nlogger = logging.getLogger(__name__)\n\n\ndef insert_ow4_users_into_g_suite(domain, group_name, missing_users, suppress_http_errors=False):\n    \"\"\"\n    Inserts a list of OW4 users into a G Suite group.\n    :param domain: The domain in which to insert a user into a group.\n    :type domain: str\n    :param group_name: The name of the group to insert the user into.\n    :type group_name: str\n    :param missing_users: A list of the missing users to be inserted into said group.\n    :type missing_users: list\n    \"\"\"\n    for missing_user in missing_users:\n        insert_ow4_user_into_g_suite_group(domain, group_name, missing_user, suppress_http_errors=suppress_http_errors)\n\n\ndef remove_excess_g_suite_users(domain, group_name, g_suite_excess_users, suppress_http_errors=False):\n    \"\"\"\n    Removes excess users from a G Suite group.\n    :param domain: The domain in which to remove a user from a group.\n    :type domain: str\n    :param group_name: The name of the group to remove the users from.\n    :type group_name: str\n    :param g_suite_excess_users: A list of the excess users to be removed from said group.\n    :type g_suite_excess_users: list\n    \"\"\"\n    logger.info(\"Cleaning G Suite group '{group}'.\".format(group=group_name),\n                extra={'group': group_name, 'excess_users': g_suite_excess_users})\n\n    for excess_user in g_suite_excess_users:\n        resp = remove_g_suite_user_from_group(domain, group_name, excess_user,\n                                              suppress_http_errors=suppress_http_errors)\n        logger.debug('Response from cleaning {group_name}: {resp}'.format(group_name=group_name, resp=resp))\n\n\ndef insert_ow4_user_into_groups(domain, user, group_names, suppress_http_errors=False):\n    \"\"\"\n    Inserts a single OW4 user into a G Suite group.\n    :param domain: The domain in which to insert a user into a group.\n    :type domain: str\n    :param user: The user to update group memberships for.\n    :type user: apps.authentication.models.OnlineUser\n    :param group_names: A list of group names to insert the user into.\n    :type group_names: list\n    :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.\n    :type suppress_http_errors: bool\n    \"\"\"\n    groups = [\"{group}@{domain}\".format(group=group_name, domain=domain) for group_name in group_names]\n    if groups:\n        logger.info('Inserting {user} into some new G Suite groups.'.format(user=user),\n                    extra={'new_groups': group_names, 'user': user})\n    for group in groups:\n        insert_ow4_user_into_g_suite_group(domain, group, user, suppress_http_errors=suppress_http_errors)\n\n\ndef cleanup_groups_for_user(domain, user, suppress_http_errors=False):\n    \"\"\"\n    Finds excess groups for a OW4 user, and removes the user from said groups.\n    :param domain: The domain in which to find a users excess group memberships.\n    :type domain: str\n    :param user: The user to remove excess group memberships for.\n    :type user: apps.authentication.models.OnlineUser\n    :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.\n    :type suppress_http_errors: bool\n    \"\"\"\n    excess_groups = get_excess_groups_for_user(domain, user)\n    if excess_groups:\n        logger.debug('Removing \"{user}\" from some G Suite groups.'.format(user=user),\n                     extra={'user': user, 'excess_groups': excess_groups})\n    for group in excess_groups:\n        remove_g_suite_user_from_group(domain, group, user.online_mail, suppress_http_errors=suppress_http_errors)\n\n\ndef update_g_suite_user(domain, ow4_user, suppress_http_errors=False):\n    \"\"\"\n    Finds missing and excess groups and adds and removes the user to/from them, respectively.\n    :param domain: The domain in which to update a users group memberships.\n    :type domain: str\n    :param ow4_user: The user to update group memberships for.\n    :type ow4_user: apps.authentication.models.OnlineUser\n    :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.\n    :type suppress_http_errors: bool\n    \"\"\"\n    cleanup_groups_for_user(domain, ow4_user, suppress_http_errors=suppress_http_errors)\n    insert_ow4_user_into_groups(domain, ow4_user, get_missing_g_suite_group_names_for_user(domain, ow4_user),\n                                suppress_http_errors=suppress_http_errors)\n\n\ndef update_g_suite_group(domain, group_name, suppress_http_errors=False):\n    \"\"\"\n    Finds missing and excess users and adds and removes the users to/from them, respectively.\n    :param domain: The domain in which to find a group's user lists.\n    :type domain: str\n    :param group_name: The name of the group to get group membership status for.\n    :type group_name: str\n    :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.\n    :type suppress_http_errors: bool\n    \"\"\"\n    g_suite_users = get_g_suite_users_for_group(domain, group_name, suppress_http_errors=suppress_http_errors)\n    ow4_users = get_ow4_users_for_group(group_name)\n\n    excess_users = get_excess_users_in_g_suite(g_suite_users, ow4_users)\n    missing_users = get_missing_ow4_users_for_g_suite(g_suite_users, ow4_users)\n\n    # @ToDo: Look into bulk updates\n    insert_ow4_users_into_g_suite(domain, group_name, missing_users, suppress_http_errors=suppress_http_errors)\n    remove_excess_g_suite_users(domain, group_name, excess_users, suppress_http_errors=suppress_http_errors)\n", "path": "apps/gsuite/mail_syncer/main.py"}], "after_files": [{"content": "import logging\n\nfrom django.conf import settings\n\nfrom apps.gsuite.mail_syncer.utils import (get_excess_groups_for_user, get_excess_users_in_g_suite,\n                                           get_g_suite_users_for_group,\n                                           get_missing_g_suite_group_names_for_user,\n                                           get_missing_ow4_users_for_g_suite,\n                                           get_ow4_users_for_group,\n                                           insert_ow4_user_into_g_suite_group,\n                                           remove_g_suite_user_from_group)\n\nlogger = logging.getLogger(__name__)\n\n\ndef insert_ow4_users_into_g_suite(domain, group_name, missing_users, suppress_http_errors=False):\n    \"\"\"\n    Inserts a list of OW4 users into a G Suite group.\n    :param domain: The domain in which to insert a user into a group.\n    :type domain: str\n    :param group_name: The name of the group to insert the user into.\n    :type group_name: str\n    :param missing_users: A list of the missing users to be inserted into said group.\n    :type missing_users: list\n    \"\"\"\n    for missing_user in missing_users:\n        insert_ow4_user_into_g_suite_group(domain, group_name, missing_user, suppress_http_errors=suppress_http_errors)\n\n\ndef remove_excess_g_suite_users(domain, group_name, g_suite_excess_users, suppress_http_errors=False):\n    \"\"\"\n    Removes excess users from a G Suite group.\n    :param domain: The domain in which to remove a user from a group.\n    :type domain: str\n    :param group_name: The name of the group to remove the users from.\n    :type group_name: str\n    :param g_suite_excess_users: A list of the excess users to be removed from said group.\n    :type g_suite_excess_users: list\n    \"\"\"\n    logger.info(\"Cleaning G Suite group '{group}'.\".format(group=group_name),\n                extra={'group': group_name, 'excess_users': g_suite_excess_users})\n\n    for excess_user in g_suite_excess_users:\n        resp = remove_g_suite_user_from_group(domain, group_name, excess_user,\n                                              suppress_http_errors=suppress_http_errors)\n        logger.debug('Response from cleaning {group_name}: {resp}'.format(group_name=group_name, resp=resp))\n\n\ndef insert_ow4_user_into_groups(domain, user, group_names, suppress_http_errors=False):\n    \"\"\"\n    Inserts a single OW4 user into a G Suite group.\n    :param domain: The domain in which to insert a user into a group.\n    :type domain: str\n    :param user: The user to update group memberships for.\n    :type user: apps.authentication.models.OnlineUser\n    :param group_names: A list of group names to insert the user into.\n    :type group_names: list\n    :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.\n    :type suppress_http_errors: bool\n    \"\"\"\n    groups = [\"{group}@{domain}\".format(group=group_name, domain=domain) for group_name in group_names]\n    if groups:\n        logger.info('Inserting {user} into some new G Suite groups.'.format(user=user),\n                    extra={'new_groups': group_names, 'user': user})\n    for group in groups:\n        insert_ow4_user_into_g_suite_group(domain, group, user, suppress_http_errors=suppress_http_errors)\n\n\ndef cleanup_groups_for_user(domain, user, suppress_http_errors=False):\n    \"\"\"\n    Finds excess groups for a OW4 user, and removes the user from said groups.\n    :param domain: The domain in which to find a users excess group memberships.\n    :type domain: str\n    :param user: The user to remove excess group memberships for.\n    :type user: apps.authentication.models.OnlineUser\n    :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.\n    :type suppress_http_errors: bool\n    \"\"\"\n    excess_groups = get_excess_groups_for_user(domain, user)\n    if excess_groups:\n        logger.debug('Removing \"{user}\" from some G Suite groups.'.format(user=user),\n                     extra={'user': user, 'excess_groups': excess_groups})\n    for group in excess_groups:\n        remove_g_suite_user_from_group(domain, group, user.online_mail, suppress_http_errors=suppress_http_errors)\n\n\ndef update_g_suite_user(domain, ow4_user, suppress_http_errors=False):\n    \"\"\"\n    Finds missing and excess groups and adds and removes the user to/from them, respectively.\n    :param domain: The domain in which to update a users group memberships.\n    :type domain: str\n    :param ow4_user: The user to update group memberships for.\n    :type ow4_user: apps.authentication.models.OnlineUser\n    :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.\n    :type suppress_http_errors: bool\n    \"\"\"\n    cleanup_groups_for_user(domain, ow4_user, suppress_http_errors=suppress_http_errors)\n    insert_ow4_user_into_groups(domain, ow4_user, get_missing_g_suite_group_names_for_user(domain, ow4_user),\n                                suppress_http_errors=suppress_http_errors)\n\n\ndef update_g_suite_group(domain, group_name, suppress_http_errors=False):\n    \"\"\"\n    Finds missing and excess users and adds and removes the users to/from them, respectively.\n    :param domain: The domain in which to find a group's user lists.\n    :type domain: str\n    :param group_name: The name of the group to get group membership status for.\n    :type group_name: str\n    :param suppress_http_errors: Whether or not to suppress HttpErrors happening during execution.\n    :type suppress_http_errors: bool\n    \"\"\"\n\n    if group_name.lower() not in settings.OW4_GSUITE_SYNC.get('GROUPS', {}).keys():\n        logger.debug('Not running group syncer for group {} - group syncing not enabled for this group'\n                     .format(group_name))\n        return\n\n    g_suite_users = get_g_suite_users_for_group(domain, group_name, suppress_http_errors=suppress_http_errors)\n    ow4_users = get_ow4_users_for_group(group_name)\n\n    excess_users = get_excess_users_in_g_suite(g_suite_users, ow4_users)\n    missing_users = get_missing_ow4_users_for_g_suite(g_suite_users, ow4_users)\n\n    # @ToDo: Look into bulk updates\n    insert_ow4_users_into_g_suite(domain, group_name, missing_users, suppress_http_errors=suppress_http_errors)\n    remove_excess_g_suite_users(domain, group_name, excess_users, suppress_http_errors=suppress_http_errors)\n", "path": "apps/gsuite/mail_syncer/main.py"}]}