From ee04f5e3f8676f7746aa117d03ec24eb6607cb49 Mon Sep 17 00:00:00 2001 From: Leif Battermann Date: Wed, 6 Nov 2024 13:33:33 +0000 Subject: [PATCH 1/3] update nginx configs --- charts/nginz/values.yaml | 6 ++++++ services/nginz/integration-test/conf/nginz/nginx.conf | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/charts/nginz/values.yaml b/charts/nginz/values.yaml index b853e1b2cde..8560dab1ac4 100644 --- a/charts/nginz/values.yaml +++ b/charts/nginz/values.yaml @@ -468,6 +468,9 @@ nginx_conf: - path: /oauth/applications envs: - all + - path: /upgrade-personal-to-team$ + envs: + - all galley: - path: /conversations/code-check disable_zauth: true @@ -557,6 +560,9 @@ nginx_conf: disable_zauth: true basic_auth: true versioned: false + - path: /teams/invitations/accept$ + envs: + - all - path: /custom-backend/by-domain/([^/]*)$ disable_zauth: true envs: diff --git a/services/nginz/integration-test/conf/nginz/nginx.conf b/services/nginz/integration-test/conf/nginz/nginx.conf index bfbc75ccc7c..f674540cd5d 100644 --- a/services/nginz/integration-test/conf/nginz/nginx.conf +++ b/services/nginz/integration-test/conf/nginz/nginx.conf @@ -339,6 +339,16 @@ http { proxy_pass http://brig; } + location ~* ^(/v[0-9]+)?/upgrade-personal-to-team$ { + include common_response_with_zauth.conf; + proxy_pass http://brig; + } + + location ~* ^(/v[0-9]+)?/teams/invitation/accept$ { + include common_response_with_zauth.conf; + proxy_pass http://brig; + } + # Cargohold Endpoints location ~* ^(/v[0-9]+)?/assets { From f192f09742449bf8a6b95b2b06bcc0b23d70086b Mon Sep 17 00:00:00 2001 From: Leif Battermann Date: Wed, 6 Nov 2024 13:36:18 +0000 Subject: [PATCH 2/3] changelog --- changelog.d/3-bug-fixes/WBP-10658 | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/3-bug-fixes/WBP-10658 diff --git a/changelog.d/3-bug-fixes/WBP-10658 b/changelog.d/3-bug-fixes/WBP-10658 new file mode 100644 index 00000000000..34c24d43291 --- /dev/null +++ b/changelog.d/3-bug-fixes/WBP-10658 @@ -0,0 +1 @@ +Updated `nginz` config for personal user to team flow From 5ab8186c5d29106639eeb25ea37fd150935e3952 Mon Sep 17 00:00:00 2001 From: Leif Battermann Date: Wed, 6 Nov 2024 13:57:37 +0000 Subject: [PATCH 3/3] use nginz in integration test --- integration/test/API/Nginz.hs | 5 +++++ integration/test/Test/Teams.hs | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/integration/test/API/Nginz.hs b/integration/test/API/Nginz.hs index ac248fd544f..cee0b05f4b6 100644 --- a/integration/test/API/Nginz.hs +++ b/integration/test/API/Nginz.hs @@ -90,3 +90,8 @@ buildUploadAssetRequestBody isPublic retention body mimeType = do "retention" .= mbRetention ] HTTP.RequestBodyLBS <$> buildMultipartBody header' body mimeType + +upgradePersonalToTeam :: (HasCallStack, MakesValue user) => user -> String -> String -> App Response +upgradePersonalToTeam user token name = do + req <- baseRequest user Brig Versioned $ joinHttpPath ["upgrade-personal-to-team"] + submit "POST" $ req & addJSONObject ["name" .= name, "icon" .= "default"] & addHeader "Authorization" ("Bearer " <> token) diff --git a/integration/test/Test/Teams.hs b/integration/test/Test/Teams.hs index 5ce10031fba..aa197ac5493 100644 --- a/integration/test/Test/Teams.hs +++ b/integration/test/Test/Teams.hs @@ -24,6 +24,7 @@ import API.Common import API.Galley (getTeam, getTeamMembers, getTeamMembersCsv, getTeamNotifications) import API.GalleyInternal (setTeamFeatureStatus) import API.Gundeck +import qualified API.Nginz as Nginz import Control.Monad.Codensity (Codensity (runCodensity)) import Control.Monad.Extra (findM) import Control.Monad.Reader (asks) @@ -256,8 +257,10 @@ testTeamUserCannotBeInvited = do testUpgradePersonalToTeam :: (HasCallStack) => App () testUpgradePersonalToTeam = do alice <- randomUser OwnDomain def + email <- alice %. "email" >>= asString let teamName = "wonderland" - tid <- bindResponse (upgradePersonalToTeam alice teamName) $ \resp -> do + token <- Nginz.login OwnDomain email defPassword >>= getJSON 200 >>= (%. "access_token") & asString + tid <- bindResponse (Nginz.upgradePersonalToTeam alice token teamName) $ \resp -> do resp.status `shouldMatchInt` 200 resp.json %. "team_name" `shouldMatch` teamName resp.json %. "team_id"