-
Notifications
You must be signed in to change notification settings - Fork 4
CORE-107: save user profile for already-registered users #1466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
var mockKeyValues: Map[String, Set[FireCloudKeyValue]] = | ||
Map( | ||
NORMAL_USER -> baseProfile, | ||
"foo" -> baseProfile, // to match registeredUser, enabledUserInfo, unknownUserInfo from MockSamDao |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the fix to save registered user's profiles under userInfo.userSubjectId
requires this tweak to the testing mock
val googleLegacyUserInfo = UserInfo("google-legacy@example.com", OAuth2BearerToken("token"), 1, "111111111111", None) | ||
val azureB2CUserInfo: UserInfo = UserInfo("azure-b2c@example.com", OAuth2BearerToken("token"), 1, "0f3cd8e4-59c2-4bce-9c24-98c5a0c308c1", None) | ||
val googleB2CUserInfo: UserInfo = UserInfo("google-b2c@example.com", OAuth2BearerToken("token"), 1, "0617047d-a81f-4724-b783-b5af51af9a70", Some(OAuth2BearerToken("some-google-token"))) | ||
val googleLegacyUserInfo: UserInfo = UserInfo("google-legacy@example.com", OAuth2BearerToken("token"), 1, "111111111111", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding the type definitions to eliminate some IntelliJ warnings
Because the original profile was created during registration using `userInfo.userSubjectId` (see | ||
`registrationResultUserInfo` above), we use that same id here. | ||
*/ | ||
thurloeDao.saveProfile(userInfo.copy(id = isRegistered.userInfo.userSubjectId), basicProfile) map (_ => isRegistered) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1405 changed the logic from (pseudocode):
saveProfile()
if (user is not registered) {
registerUser()
}
to:
if (user is not registered) {
saveProfileAndRegisterUser()
}
This PR changes it to:
if (user is not registered) {
saveProfileAndRegisterUser()
} else {
saveProfile()
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
https://broadworkbench.atlassian.net/browse/CORE-107
When users who are already registered attempt to update their user profile, we were not actually updating that profile. This PR fixes a regression from #1405.