Skip to content
Snippets Groups Projects
Commit 33065db7 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

Fix intermittent IntegrityError in control room group middleware

parent c779476b
No related branches found
No related tags found
No related merge requests found
......@@ -126,8 +126,11 @@ class ControlRoomMiddleware(object):
# Add user to control room group(s)
for ifo, ip in settings.CONTROL_ROOM_IPS.iteritems():
if (ip == user_ip):
request.user.groups.add(Group.objects.get(name=
ifo.lower() + self.control_room_group_suffix))
control_room_group = Group.objects.get(name=
(ifo.lower() + self.control_room_group_suffix))
request.user.groups.through.objects.get_or_create(
user=request.user, group=control_room_group)
break
return request
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment