From 83228eb551cd861f8d7fbc71b14a0af6f676e593 Mon Sep 17 00:00:00 2001 From: Saman Ehsan Date: Wed, 28 Aug 2024 15:03:52 -0400 Subject: [PATCH 1/4] [ID-1371] Update workbench-libs version (#1526) * Update workbench-libs version Adds retry on global resource usage limited errors to operations that did not have that check before. * Update test dependencies * Fix workbench notifications version --- automation/project/Dependencies.scala | 4 ++-- project/Dependencies.scala | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/automation/project/Dependencies.scala b/automation/project/Dependencies.scala index 15ee69783..f94a933cb 100644 --- a/automation/project/Dependencies.scala +++ b/automation/project/Dependencies.scala @@ -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" diff --git a/project/Dependencies.scala b/project/Dependencies.scala index bc9dba895..53bcc7b1a 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -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" From 0bf45d3d685549ef9681b11d7fb28b8609304e83 Mon Sep 17 00:00:00 2001 From: Tristan Garwood Date: Wed, 28 Aug 2024 20:30:41 -0400 Subject: [PATCH 2/4] ID-1369 Repair cloud access followup: fix swagger (#1529) * ID-1369 Repair cloud access followup: fix swagger * ID-1369 Repair cloud access followup, fix swagger --- src/main/resources/swagger/api-docs.yaml | 2 +- .../dsde/workbench/sam/service/UserService.scala | 1 + .../dsde/workbench/sam/service/UserServiceSpec.scala | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/resources/swagger/api-docs.yaml b/src/main/resources/swagger/api-docs.yaml index 432f2ccc8..d5430a19f 100755 --- a/src/main/resources/swagger/api-docs.yaml +++ b/src/main/resources/swagger/api-docs.yaml @@ -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. diff --git a/src/main/scala/org/broadinstitute/dsde/workbench/sam/service/UserService.scala b/src/main/scala/org/broadinstitute/dsde/workbench/sam/service/UserService.scala index f7b4fec1a..10c0cf376 100644 --- a/src/main/scala/org/broadinstitute/dsde/workbench/sam/service/UserService.scala +++ b/src/main/scala/org/broadinstitute/dsde/workbench/sam/service/UserService.scala @@ -496,6 +496,7 @@ class UserService( case Some(user) => for { _ <- cloudExtensions.onUserCreate(user, samRequestContext) + _ <- cloudExtensions.onUserEnable(user, samRequestContext) groups <- directoryDAO.listUserDirectMemberships(user.id, samRequestContext) _ <- cloudExtensions.onGroupUpdate(groups, Set(user.id), samRequestContext) } yield IO.pure(()) diff --git a/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala b/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala index 3e53480ac..8096c8001 100644 --- a/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala +++ b/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala @@ -747,8 +747,8 @@ 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), Set(invitedUserId), samRequestContext) } } From ec415b90f7bf791eb3f2c6170d9391bfb515cca6 Mon Sep 17 00:00:00 2001 From: Tristan Garwood Date: Thu, 29 Aug 2024 10:47:34 -0400 Subject: [PATCH 3/4] ID-1369 Repair cloud access followup, increment group version (#1530) --- .../dsde/workbench/sam/service/UserService.scala | 6 ++++-- .../dsde/workbench/sam/service/UserServiceSpec.scala | 11 ++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/scala/org/broadinstitute/dsde/workbench/sam/service/UserService.scala b/src/main/scala/org/broadinstitute/dsde/workbench/sam/service/UserService.scala index 10c0cf376..5972106ad 100644 --- a/src/main/scala/org/broadinstitute/dsde/workbench/sam/service/UserService.scala +++ b/src/main/scala/org/broadinstitute/dsde/workbench/sam/service/UserService.scala @@ -495,9 +495,11 @@ class UserService( maybeUser.flatMap { case Some(user) => for { - _ <- cloudExtensions.onUserCreate(user, samRequestContext) - _ <- 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 _ => () } 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"))) diff --git a/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala b/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala index 8096c8001..ae49cdf56 100644 --- a/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala +++ b/src/test/scala/org/broadinstitute/dsde/workbench/sam/service/UserServiceSpec.scala @@ -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("fake@group.com")) + 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 @@ -749,6 +754,10 @@ class OldUserServiceSpec(_system: ActorSystem) verify(googleExtensions).onUserCreate(updatedUserInPostgres.get, samRequestContext) verify(googleExtensions).onUserEnable(updatedUserInPostgres.get, samRequestContext) - verify(googleExtensions).onGroupUpdate(Seq(allUsersGroup.id), Set(invitedUserId), samRequestContext) + verify(googleExtensions).onGroupUpdate(Seq(allUsersGroup.id, group.id), Set(invitedUserId), samRequestContext) + + // get group from db + val groupWithUpdatedVersion = runAndWait(dirDAO.loadGroup(group.id, samRequestContext)) + groupWithUpdatedVersion.get.version shouldBe group.version + 1 } } From c3ce16a8343d3f016f7208fe48a4069e3e9377fc Mon Sep 17 00:00:00 2001 From: Olivia Kotsopoulos Date: Wed, 4 Sep 2024 12:48:39 -0400 Subject: [PATCH 4/4] [DCJ-400] #major version bump (#1527) At some point in the past, Sam started publishing its clients with semantic versions. Recently, we enabled Dependabot in jade-data-repo and saw a PR opened with a bad Sam dependency change as a result: v0.0.241 -> 0.1-9867891-SNAP The latter is an old prerelease version published as part of a PR commit from before Sam's usage of semver for publishing. Bumping Sam to a new major version in an effort to move past any old pre-semver publications.