@@ -165,37 +165,36 @@ async def list_users(
165165 password_needs_reset = user .reset_password ,
166166 )
167167 )
168- elif isinstance (user , models .OAuth2User ):
168+ elif isinstance (user , models .OAuth2User ) and is_ldap_user ( user . oauth2_client_id ) :
169169 # Check if this is an LDAP user (identified by special marker)
170- if is_ldap_user (user .oauth2_client_id ):
171- data .append (
172- LDAPUser (
173- id = str (GlobalID ("User" , str (user .id ))),
174- username = user .username ,
175- email = user .email ,
176- role = user .role .name ,
177- created_at = user .created_at ,
178- updated_at = user .updated_at ,
179- auth_method = "LDAP" ,
180- )
181- )
182- else :
183- oauth2_user = OAuth2User (
170+ data .append (
171+ LDAPUser (
184172 id = str (GlobalID ("User" , str (user .id ))),
185173 username = user .username ,
186174 email = user .email ,
187175 role = user .role .name ,
188176 created_at = user .created_at ,
189177 updated_at = user .updated_at ,
190- auth_method = "OAUTH2 " ,
178+ auth_method = "LDAP " ,
191179 )
192- if user .oauth2_client_id :
193- oauth2_user .oauth2_client_id = user .oauth2_client_id
194- if user .oauth2_user_id :
195- oauth2_user .oauth2_user_id = user .oauth2_user_id
196- if user .profile_picture_url :
197- oauth2_user .profile_picture_url = user .profile_picture_url
198- data .append (oauth2_user )
180+ )
181+ elif isinstance (user , models .OAuth2User ):
182+ oauth2_user = OAuth2User (
183+ id = str (GlobalID ("User" , str (user .id ))),
184+ username = user .username ,
185+ email = user .email ,
186+ role = user .role .name ,
187+ created_at = user .created_at ,
188+ updated_at = user .updated_at ,
189+ auth_method = "OAUTH2" ,
190+ )
191+ if user .oauth2_client_id :
192+ oauth2_user .oauth2_client_id = user .oauth2_client_id
193+ if user .oauth2_user_id :
194+ oauth2_user .oauth2_user_id = user .oauth2_user_id
195+ if user .profile_picture_url :
196+ oauth2_user .profile_picture_url = user .profile_picture_url
197+ data .append (oauth2_user )
199198 return GetUsersResponseBody (next_cursor = next_cursor , data = data )
200199
201200
0 commit comments