From 391969514f768ed6e2407c316f54219ea3ef7222 Mon Sep 17 00:00:00 2001 From: Tasos Katsoulas Date: Mon, 2 Sep 2019 15:47:38 +0300 Subject: [PATCH] Remove all access groups if user in not in NDAs. --- mozillians/groups/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mozillians/groups/models.py b/mozillians/groups/models.py index 91398e5f..4ce60957 100644 --- a/mozillians/groups/models.py +++ b/mozillians/groups/models.py @@ -390,7 +390,8 @@ class Group(GroupBase): send_email = True # Remove all the access groups the user is a member of # if the group to remove is the NDA - if self.name in settings.NDA_ACCESS_GROUPS: + if not GroupMembership.objects.filter(userprofile=userprofile, + group__name__in=settings.NDA_ACCESS_GROUPS): group_memberships = GroupMembership.objects.none() # If the user is not staff, we need to delete the memberships to any access group if not userprofile.can_create_access_groups: