Skip to content

Commit

Permalink
Merge branch 'develop' into arh-wor-1718
Browse files Browse the repository at this point in the history
  • Loading branch information
marctalbott authored Sep 4, 2024
2 parents b595454 + c3ce16a commit bf6e936
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions automation/project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ object Dependencies {
val akkaV = "2.6.19"
val akkaHttpV = "10.2.2"

val workbenchLibV = "9138393"
val workbenchLibV = "3c223be"

val workbenchGoogleV = s"0.32-$workbenchLibV"
val workbenchGoogleV = s"0.33-$workbenchLibV"
val workbenchGoogle2V = s"0.36-$workbenchLibV"
val workbenchServiceTestV = s"5.0-$workbenchLibV"

Expand Down
6 changes: 3 additions & 3 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ object Dependencies {
val postgresDriverVersion = "42.7.2"
val sentryVersion = "6.15.0"

val workbenchLibV = "8d55689" // If updating this, make sure googleStorageLocal in test dependencies is up-to-date
val workbenchLibV = "3c223be" // If updating this, make sure googleStorageLocal in test dependencies is up-to-date
val workbenchUtilV = s"0.10-$workbenchLibV"
val workbenchUtil2V = s"0.9-$workbenchLibV"
val workbenchModelV = s"0.20-$workbenchLibV"
val workbenchGoogleV = s"0.32-$workbenchLibV"
val workbenchGoogleV = s"0.33-$workbenchLibV"
val workbenchGoogle2V = s"0.36-$workbenchLibV"
val workbenchNotificationsV = s"0.6-$workbenchLibV"
val workbenchNotificationsV = s"0.7-$workbenchLibV"
val workbenchOauth2V = s"0.7-$workbenchLibV"
val monocleVersion = "2.0.5"
val crlVersion = "1.2.30-SNAPSHOT"
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/swagger/api-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ paths:
schema:
$ref: '#/components/schemas/ErrorReport'
/api/admin/v2/user/{userId}/repairCloudAccess:
get:
put:
tags:
- Admin
summary: Ensures that a user's proxy group exists and that it is added to any google groups that it should be in.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,11 @@ class UserService(
maybeUser.flatMap {
case Some(user) =>
for {
_ <- cloudExtensions.onUserCreate(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 _ => () }
groups <- directoryDAO.listUserDirectMemberships(user.id, samRequestContext)
_ = groups.map(g => directoryDAO.updateGroupUpdatedDateAndVersionWithSession(g, samRequestContext))
_ <- cloudExtensions.onGroupUpdate(groups, Set(user.id), samRequestContext)
} yield IO.pure(())
case None => IO.raiseError(new WorkbenchExceptionWithErrorReport(ErrorReport(StatusCodes.NotFound, s"User $workbenchUserId not found")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,11 @@ class OldUserServiceSpec(_system: ActorSystem)
val updatedUserInPostgres = dirDAO.loadUser(invitedUserId, samRequestContext).unsafeRunSync()
updatedUserInPostgres.value shouldBe SamUser(invitedUserId, registeringUser.googleSubjectId, inviteeEmail, None, true)

// add user to group
val group = BasicWorkbenchGroup(WorkbenchGroupName("testGroup"), Set.empty, WorkbenchEmail("[email protected]"))
runAndWait(dirDAO.createGroup(group, None, samRequestContext))
runAndWait(dirDAO.addGroupMember(group.id, invitedUserId, samRequestContext))

val proxyGroup =
WorkbenchGroupName(s"${googleServicesConfig.resourceNamePrefix.getOrElse("")}PROXY_${invitedUserId.value}@${googleServicesConfig.appsDomain}")
// delete proxy group
Expand All @@ -747,8 +752,12 @@ class OldUserServiceSpec(_system: ActorSystem)
// Run test
service.repairCloudAccess(invitedUserId, samRequestContext).unsafeRunSync()

verify(googleExtensions).onUserCreate(SamUser(invitedUserId, registeringUser.googleSubjectId, inviteeEmail, None, true), samRequestContext)
verify(googleExtensions).onUserCreate(updatedUserInPostgres.get, samRequestContext)
verify(googleExtensions).onUserEnable(updatedUserInPostgres.get, samRequestContext)
verify(googleExtensions).onGroupUpdate(Seq(allUsersGroup.id, group.id), Set(invitedUserId), samRequestContext)

verify(googleExtensions).onGroupUpdate(Seq(allUsersGroup.id), Set(invitedUserId), samRequestContext)
// get group from db
val groupWithUpdatedVersion = runAndWait(dirDAO.loadGroup(group.id, samRequestContext))
groupWithUpdatedVersion.get.version shouldBe group.version + 1
}
}

0 comments on commit bf6e936

Please sign in to comment.