Skip to content

Conversation

davidangb
Copy link
Contributor

@davidangb davidangb commented Oct 23, 2024

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.

var mockKeyValues: Map[String, Set[FireCloudKeyValue]] =
Map(
NORMAL_USER -> baseProfile,
"foo" -> baseProfile, // to match registeredUser, enabledUserInfo, unknownUserInfo from MockSamDao
Copy link
Contributor Author

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)
Copy link
Contributor Author

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)
Copy link
Contributor Author

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()
}

@davidangb davidangb changed the title CORE-107: save profile CORE-107: save user profile for already-registered users Oct 24, 2024
@davidangb davidangb requested review from a team, samanehsan and trholdridge and removed request for a team October 24, 2024 20:04
Copy link
Contributor

@samanehsan samanehsan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! :octocat:

@davidangb davidangb merged commit 2974439 into develop Oct 25, 2024
12 checks passed
@davidangb davidangb deleted the da_CORE-107_saveProfile branch October 25, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants