diff --git a/portal/rest/users.py b/portal/rest/users.py
index 4b12cb336d7bc6943fa8942394d738acef31f456..110ec244a3359a1e06a01f5d566181b418d0ee92 100644
--- a/portal/rest/users.py
+++ b/portal/rest/users.py
@@ -130,8 +130,8 @@ class UserSubmissionList(Resource):
 
 
 def find_groups_intersection(user1: User, user2: User):
-    temp = [user2.groups]
-    res = [value for value in user1.groups if value in temp]
+    other_groups = user2.groups
+    res = [group for group in user1.groups if group in other_groups]
     return res