Skip to content

Commit

Permalink
WPB-10658 invitation and acceptance of individual users to teams fix …
Browse files Browse the repository at this point in the history
…nginz config (#4334)
  • Loading branch information
battermann authored Nov 6, 2024
1 parent f4c370b commit 351e0b9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/3-bug-fixes/WBP-10658
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated `nginz` config for personal user to team flow
6 changes: 6 additions & 0 deletions charts/nginz/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions integration/test/API/Nginz.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 4 additions & 1 deletion integration/test/Test/Teams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down
10 changes: 10 additions & 0 deletions services/nginz/integration-test/conf/nginz/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 351e0b9

Please sign in to comment.