Skip to content
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

ID-1369 Repair cloud access followup, increment group version #1530

Conversation

Ghost-in-a-Jar
Copy link
Contributor

@Ghost-in-a-Jar Ghost-in-a-Jar commented Aug 29, 2024

Ticket: https://broadworkbench.atlassian.net/browse/ID-1369

Creation of the proxy group works, but adding the proxy to the groups it should be in doesnt because we need to increment those group versions so that the sync messages dont get deduped.

PR checklist

  • I've followed the instructions if I've made any changes to the API, especially if they're breaking changes
  • I've filled out the Security Risk Assessment (requires Broad Internal network access) and attached the result to the JIRA ticket

_ <- cloudExtensions.onUserEnable(user, samRequestContext)
// if the user is already created and enabled, then recover and just add them to the groups they should be in
_ <- cloudExtensions.onUserCreate(user, samRequestContext).recover({ case _ => () })
_ <- cloudExtensions.onUserEnable(user, samRequestContext).recover({ case _ => () })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just added a wildcard recover to these to make this whole call fully idempotent i.e. running it multiple times on the same user should have the same end effect and not error out if their proxy group is already there etc.

groups <- directoryDAO.listUserDirectMemberships(user.id, samRequestContext)
_ = groups.map(g => directoryDAO.updateGroupUpdatedDateAndVersionWithSession(g, samRequestContext))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This increments all the group versions so that the group sync messages dont get deduped


// get group from db
val groupWithUpdatedVersion = runAndWait(dirDAO.loadGroup(group.id, samRequestContext))
groupWithUpdatedVersion.get.version shouldBe group.version + 1
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 important assertion

@Ghost-in-a-Jar Ghost-in-a-Jar force-pushed the ID-1369-repair-cloud-access-followup-increment-group-version branch from d83edc0 to fd477b9 Compare August 29, 2024 14:23
Copy link

@Ghost-in-a-Jar Ghost-in-a-Jar merged commit ec415b9 into develop Aug 29, 2024
22 of 23 checks passed
@Ghost-in-a-Jar Ghost-in-a-Jar deleted the ID-1369-repair-cloud-access-followup-increment-group-version branch August 29, 2024 14:47
@ungwudik
Copy link

@Ghost-in-a-Jar looks like sam-swat-test-job (dev, qa) failed. Checking to confirm the team was aware.

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.

4 participants