Skip to content

Commit

Permalink
fix galley tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jschaul committed Aug 30, 2019
1 parent 290528c commit 0f19035
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion services/brig/src/Brig/User/Auth.hs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ legalHoldLogin (LegalHoldLogin uid plainTextPassword label) typ = do
-- legalhold login is only possible if
-- * the user is a team user
-- * and the team has legalhold enabled
mteam <- lift $ Data.lookupUserTeam uid
mteam <- lift $ Intra.getTeamId uid
case mteam of
Nothing -> throwE LegalHoldLoginNoBindingTeam
Just tid -> assertLegalHoldEnabled uid tid
Expand Down
2 changes: 1 addition & 1 deletion services/galley/src/Galley/API/LegalHold.hs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ approveDevice (zusr ::: tid ::: uid ::: connId ::: req ::: _) = do

clientId <- Client.addLegalHoldClientToUser uid connId prekeys lastPrekey'

legalHoldAuthToken <- Client.getLegalHoldAuthToken uid
legalHoldAuthToken <- Client.getLegalHoldAuthToken uid mPassword
LHService.confirmLegalHold clientId tid uid legalHoldAuthToken
LegalHoldData.setUserLegalHoldStatus tid uid UserLegalHoldEnabled
-- TODO: send event at this point (see also:
Expand Down
9 changes: 5 additions & 4 deletions services/galley/src/Galley/Intra/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Imports
import Bilge hiding (options, getHeader, statusCode)
import Bilge.RPC
import Brig.Types.Intra
import Brig.Types.User.Auth (SsoLogin(..))
import Brig.Types.User.Auth (LegalHoldLogin(..))
import Brig.Types.Client.Prekey (LastPrekey, Prekey)
import Brig.Types.Client
import Brig.Types.Team.LegalHold (LegalHoldClientRequest(..))
Expand All @@ -23,6 +23,7 @@ import Galley.Intra.Util
import Galley.Types (UserClients, filterClients)
import Data.Id
import Data.Text.Encoding
import Data.Misc
import Network.HTTP.Types.Method
import Network.HTTP.Types.Status
import Network.Wai.Utilities.Error
Expand Down Expand Up @@ -52,16 +53,16 @@ notifyClientsAboutLegalHoldRequest requesterUid targetUid lastPrekey' = do
. json (LegalHoldClientRequest requesterUid lastPrekey')
. expect2xx

getLegalHoldAuthToken :: UserId -> Galley OpaqueAuthToken
getLegalHoldAuthToken uid = do
getLegalHoldAuthToken :: UserId -> Maybe PlainTextPassword -> Galley OpaqueAuthToken
getLegalHoldAuthToken uid pw = do
(brigHost, brigPort) <- brigReq
r <- call "brig" $
method POST
. host brigHost
. port brigPort
. path "/i/legalhold-login"
. queryItem "persist" "true"
. json (SsoLogin uid Nothing)
. json (LegalHoldLogin uid pw Nothing)
. expect2xx
case getCookieValue "zuid" r of
Nothing -> do
Expand Down

0 comments on commit 0f19035

Please sign in to comment.