File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -873,10 +873,9 @@ def get_current_user_with_groups(
873873 query = (
874874 session .query (Token .active , User , Group , GroupUser )
875875 .join (User , User .id == Token .user_id )
876- .join (GroupUser , GroupUser .user_id == User .id )
877- .join (Group , Group .id == GroupUser .group_id )
876+ .join (GroupUser , GroupUser .user_id == User .id , isouter = True )
877+ .join (Group , Group .id == GroupUser .group_id , isouter = True )
878878 .filter (Token .id == token )
879- .filter (GroupUser .user_id == User .id )
880879 .group_by (Token .active , User , Group , GroupUser )
881880 )
882881 objects = query .all ()
@@ -887,6 +886,9 @@ def get_current_user_with_groups(
887886 user = objects [0 ][1 ]
888887 groups = []
889888 for object in objects :
889+ # Skip if there are no groups
890+ if object [2 ] is None :
891+ continue
890892 if object [3 ].user_id != user .id :
891893 logger .error (
892894 f"Unexpected group id: { object [2 ].id } fetched for user with id: { user .id } "
You can’t perform that action at this time.
0 commit comments