@@ -136,7 +136,9 @@ public static UserIdMapping[] getUserIdMappingWithEitherSuperTokensUserIdOrExter
136
136
137
137
}
138
138
139
- public static HashMap <String , String > getUserIdMappingWithUserIds (Start start , List <String > userIds )
139
+ public static HashMap <String , String > getUserIdMappingWithUserIds (Start start ,
140
+ AppIdentifier appIdentifier ,
141
+ List <String > userIds )
140
142
throws SQLException , StorageQueryException {
141
143
142
144
if (userIds .size () == 0 ) {
@@ -145,7 +147,8 @@ public static HashMap<String, String> getUserIdMappingWithUserIds(Start start, L
145
147
146
148
// No need to filter based on tenantId because the id list is already filtered for a tenant
147
149
StringBuilder QUERY = new StringBuilder (
148
- "SELECT * FROM " + Config .getConfig (start ).getUserIdMappingTable () + " WHERE supertokens_user_id IN (" );
150
+ "SELECT * FROM " + Config .getConfig (start ).getUserIdMappingTable () + " WHERE app_id = ? AND " +
151
+ "supertokens_user_id IN (" );
149
152
for (int i = 0 ; i < userIds .size (); i ++) {
150
153
QUERY .append ("?" );
151
154
if (i != userIds .size () - 1 ) {
@@ -155,9 +158,10 @@ public static HashMap<String, String> getUserIdMappingWithUserIds(Start start, L
155
158
}
156
159
QUERY .append (")" );
157
160
return execute (start , QUERY .toString (), pst -> {
161
+ pst .setString (1 , appIdentifier .getAppId ());
158
162
for (int i = 0 ; i < userIds .size (); i ++) {
159
- // i+1 cause this starts with 1 and not 0
160
- pst .setString (i + 1 , userIds .get (i ));
163
+ // i+2 cause this starts with 1 and not 0, 1 is appId
164
+ pst .setString (i + 2 , userIds .get (i ));
161
165
}
162
166
}, result -> {
163
167
HashMap <String , String > userIdMappings = new HashMap <>();
@@ -169,7 +173,9 @@ public static HashMap<String, String> getUserIdMappingWithUserIds(Start start, L
169
173
});
170
174
}
171
175
172
- public static HashMap <String , String > getUserIdMappingWithUserIds_Transaction (Start start , Connection sqlCon , List <String > userIds )
176
+ public static HashMap <String , String > getUserIdMappingWithUserIds_Transaction (Start start , Connection sqlCon ,
177
+ AppIdentifier appIdentifier ,
178
+ List <String > userIds )
173
179
throws SQLException , StorageQueryException {
174
180
175
181
if (userIds .size () == 0 ) {
@@ -178,7 +184,8 @@ public static HashMap<String, String> getUserIdMappingWithUserIds_Transaction(St
178
184
179
185
// No need to filter based on tenantId because the id list is already filtered for a tenant
180
186
StringBuilder QUERY = new StringBuilder (
181
- "SELECT * FROM " + Config .getConfig (start ).getUserIdMappingTable () + " WHERE supertokens_user_id IN (" );
187
+ "SELECT * FROM " + Config .getConfig (start ).getUserIdMappingTable () + " WHERE app_id = ? AND " +
188
+ "supertokens_user_id IN (" );
182
189
for (int i = 0 ; i < userIds .size (); i ++) {
183
190
QUERY .append ("?" );
184
191
if (i != userIds .size () - 1 ) {
@@ -188,9 +195,10 @@ public static HashMap<String, String> getUserIdMappingWithUserIds_Transaction(St
188
195
}
189
196
QUERY .append (")" );
190
197
return execute (sqlCon , QUERY .toString (), pst -> {
198
+ pst .setString (1 , appIdentifier .getAppId ());
191
199
for (int i = 0 ; i < userIds .size (); i ++) {
192
- // i+1 cause this starts with 1 and not 0
193
- pst .setString (i + 1 , userIds .get (i ));
200
+ // i+2 cause this starts with 1 and not 0, 1 is appId
201
+ pst .setString (i + 2 , userIds .get (i ));
194
202
}
195
203
}, result -> {
196
204
HashMap <String , String > userIdMappings = new HashMap <>();
0 commit comments