@@ -223,7 +223,7 @@ public static UserInfo getUserInfoUsingId_Transaction(Start start, Connection co
223223 }
224224 return null ;
225225 });
226- return userInfoWithTenantIds_transaction (start , con , userInfo );
226+ return userInfoWithTenantIds_transaction (start , con , appIdentifier , userInfo );
227227 }
228228
229229 public static PasswordResetTokenInfo getPasswordResetTokenInfo (Start start , AppIdentifier appIdentifier , String token )
@@ -306,7 +306,7 @@ public static UserInfo signUp(Start start, TenantIdentifier tenantIdentifier, St
306306 });
307307 }
308308
309- UserInfo userInfo = userInfoWithTenantIds_transaction (start , sqlCon , new UserInfoPartial (userId , email , passwordHash , timeJoined ));
309+ UserInfo userInfo = userInfoWithTenantIds_transaction (start , sqlCon , tenantIdentifier . toAppIdentifier (), new UserInfoPartial (userId , email , passwordHash , timeJoined ));
310310
311311 sqlCon .commit ();
312312 return userInfo ;
@@ -352,7 +352,7 @@ public static UserInfo getUserInfoUsingId(Start start, AppIdentifier appIdentifi
352352 }
353353 return null ;
354354 });
355- return userInfoWithTenantIds (start , userInfo );
355+ return userInfoWithTenantIds (start , appIdentifier , userInfo );
356356 }
357357
358358 public static UserInfoPartial getUserInfoUsingId (Start start , Connection sqlCon , AppIdentifier appIdentifier , String id ) throws SQLException , StorageQueryException {
@@ -371,13 +371,13 @@ public static UserInfoPartial getUserInfoUsingId(Start start, Connection sqlCon,
371371 });
372372 }
373373
374- public static List <UserInfo > getUsersInfoUsingIdList (Start start , List <String > ids )
374+ public static List <UserInfo > getUsersInfoUsingIdList (Start start , AppIdentifier appIdentifier , List <String > ids )
375375 throws SQLException , StorageQueryException {
376376 if (ids .size () > 0 ) {
377377 // No need to filter based on tenantId because the id list is already filtered for a tenant
378378 StringBuilder QUERY = new StringBuilder ("SELECT user_id, email, password_hash, time_joined "
379379 + "FROM " + getConfig (start ).getEmailPasswordUsersTable ());
380- QUERY .append (" WHERE user_id IN (" );
380+ QUERY .append (" WHERE app_id = ? AND user_id IN (" );
381381 for (int i = 0 ; i < ids .size (); i ++) {
382382
383383 QUERY .append ("?" );
@@ -389,9 +389,10 @@ public static List<UserInfo> getUsersInfoUsingIdList(Start start, List<String> i
389389 QUERY .append (")" );
390390
391391 List <UserInfoPartial > userInfos = execute (start , QUERY .toString (), pst -> {
392+ pst .setString (1 , appIdentifier .getAppId ());
392393 for (int i = 0 ; i < ids .size (); i ++) {
393- // i+1 cause this starts with 1 and not 0
394- pst .setString (i + 1 , ids .get (i ));
394+ // i+2 cause this starts with 1 and not 0, and 1 is appId
395+ pst .setString (i + 2 , ids .get (i ));
395396 }
396397 }, result -> {
397398 List <UserInfoPartial > finalResult = new ArrayList <>();
@@ -400,7 +401,7 @@ public static List<UserInfo> getUsersInfoUsingIdList(Start start, List<String> i
400401 }
401402 return finalResult ;
402403 });
403- return userInfoWithTenantIds (start , userInfos );
404+ return userInfoWithTenantIds (start , appIdentifier , userInfos );
404405 }
405406 return Collections .emptyList ();
406407 }
@@ -423,7 +424,7 @@ public static UserInfo getUserInfoUsingEmail(Start start, TenantIdentifier tenan
423424 }
424425 return null ;
425426 });
426- return userInfoWithTenantIds (start , userInfo );
427+ return userInfoWithTenantIds (start , tenantIdentifier . toAppIdentifier (), userInfo );
427428 }
428429
429430 public static boolean addUserIdToTenant_Transaction (Start start , Connection sqlCon ,
@@ -477,35 +478,35 @@ public static boolean removeUserIdFromTenant_Transaction(Start start, Connection
477478 // automatically deleted from emailpassword_user_to_tenant because of foreign key constraint
478479 }
479480
480- private static UserInfo userInfoWithTenantIds (Start start , UserInfoPartial userInfo )
481+ private static UserInfo userInfoWithTenantIds (Start start , AppIdentifier appIdentifier , UserInfoPartial userInfo )
481482 throws SQLException , StorageQueryException {
482483 if (userInfo == null ) return null ;
483484 try (Connection con = ConnectionPool .getConnection (start )) {
484- return userInfoWithTenantIds_transaction (start , con , Arrays .asList (userInfo )).get (0 );
485+ return userInfoWithTenantIds_transaction (start , con , appIdentifier , Arrays .asList (userInfo )).get (0 );
485486 }
486487 }
487488
488- private static List <UserInfo > userInfoWithTenantIds (Start start , List <UserInfoPartial > userInfos )
489+ private static List <UserInfo > userInfoWithTenantIds (Start start , AppIdentifier appIdentifier , List <UserInfoPartial > userInfos )
489490 throws SQLException , StorageQueryException {
490491 try (Connection con = ConnectionPool .getConnection (start )) {
491- return userInfoWithTenantIds_transaction (start , con , userInfos );
492+ return userInfoWithTenantIds_transaction (start , con , appIdentifier , userInfos );
492493 }
493494 }
494495
495- private static UserInfo userInfoWithTenantIds_transaction (Start start , Connection sqlCon , UserInfoPartial userInfo )
496+ private static UserInfo userInfoWithTenantIds_transaction (Start start , Connection sqlCon , AppIdentifier appIdentifier , UserInfoPartial userInfo )
496497 throws SQLException , StorageQueryException {
497498 if (userInfo == null ) return null ;
498- return userInfoWithTenantIds_transaction (start , sqlCon , Arrays .asList (userInfo )).get (0 );
499+ return userInfoWithTenantIds_transaction (start , sqlCon , appIdentifier , Arrays .asList (userInfo )).get (0 );
499500 }
500501
501- private static List <UserInfo > userInfoWithTenantIds_transaction (Start start , Connection sqlCon , List <UserInfoPartial > userInfos )
502+ private static List <UserInfo > userInfoWithTenantIds_transaction (Start start , Connection sqlCon , AppIdentifier appIdentifier , List <UserInfoPartial > userInfos )
502503 throws SQLException , StorageQueryException {
503504 String [] userIds = new String [userInfos .size ()];
504505 for (int i = 0 ; i < userInfos .size (); i ++) {
505506 userIds [i ] = userInfos .get (i ).id ;
506507 }
507508
508- Map <String , List <String >> tenantIdsForUserIds = GeneralQueries .getTenantIdsForUserIds_transaction (start , sqlCon , userIds );
509+ Map <String , List <String >> tenantIdsForUserIds = GeneralQueries .getTenantIdsForUserIds_transaction (start , sqlCon , appIdentifier , userIds );
509510 List <UserInfo > result = new ArrayList <>();
510511 for (UserInfoPartial userInfo : userInfos ) {
511512 result .add (new UserInfo (userInfo .id , userInfo .email , userInfo .passwordHash , userInfo .timeJoined ,
0 commit comments