Skip to content

Commit

Permalink
Allow use of guests that still live in userDb but not in accountDB/Oa…
Browse files Browse the repository at this point in the history
…uth (because they were created before we started recording guests in acctdb)
  • Loading branch information
ryanrdoherty committed Sep 13, 2024
1 parent 2a15142 commit 1d2bf25
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Model/src/main/java/org/gusdb/wdk/model/user/UserFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,18 @@ public void resetPassword(String loginName) throws InvalidUsernameOrEmailExcepti
public Map<Long, User> getUsersById(List<Long> userIds) {
// ensure a unique list
userIds = new ArrayList<>(new HashSet<>(userIds));
return OAuthQuerier.getUsersById(_client, _config, userIds, json -> new BasicUser(_wdkModel, json));
Map<Long,User> userMap = OAuthQuerier.getUsersById(_client, _config, userIds, json -> new BasicUser(_wdkModel, json));
// FIXME: This is a temporary hack to account for guests created before the
// implementation of bearer tokens who still have WDK steps/strats. Eventually
// these guests should be removed during regular maintenance cleanup; once all
// guests created before spring 2024 are removed, this code can also be removed.
for (Long userId : userIds) {
if (userMap.get(userId) == null) {
// OAuth does not know about this user; trust that it is a guest
userMap.put(userId, new BasicUser(_wdkModel, userId, true, userId.toString(), userId.toString()));
}
}
return userMap;
}

public Map<String, User> getUsersByEmail(List<String> emails) {
Expand Down

0 comments on commit 1d2bf25

Please sign in to comment.