Skip to content

Commit

Permalink
fix tests and impl
Browse files Browse the repository at this point in the history
  • Loading branch information
battermann authored and pcapriotti committed Jan 20, 2025
1 parent 5ba4f9a commit fb921f3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
17 changes: 14 additions & 3 deletions integration/test/Test/DomainVerification.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module Test.DomainVerification where
import API.Brig
import API.BrigInternal
import API.Common
import API.GalleyInternal (setTeamFeatureLockStatus, setTeamFeatureStatus)
import SetupHelpers
import Test.DNSMock
import Testlib.Prelude
Expand Down Expand Up @@ -280,7 +281,12 @@ testDomainVerificationLockedState = do
testDomainVerificationLockedStateTeam :: (HasCallStack) => App ()
testDomainVerificationLockedStateTeam = do
domain <- randomDomain
(owner, _tid, _m : _) <- createTeam OwnDomain 2
(owner, tid, _m : _) <- createTeam OwnDomain 2

-- set conference calling (paying team)
assertSuccess =<< do
setTeamFeatureLockStatus owner tid "conferenceCalling" "unlocked"
setTeamFeatureStatus owner tid "conferenceCalling" "enabled"

-- [backoffice] lock the domain (public email provider)
domainRegistrationLock OwnDomain domain >>= assertStatus 204
Expand All @@ -307,12 +313,17 @@ testDomainVerificationLockedStateTeam = do

testUpdateTeamInvite :: (HasCallStack) => App ()
testUpdateTeamInvite = do
(owner, _tid, _m : _) <- createTeam OwnDomain 2
(owner, tid, _m : _) <- createTeam OwnDomain 2

-- set conference calling (paying team)
assertSuccess =<< do
setTeamFeatureLockStatus owner tid "conferenceCalling" "unlocked"
setTeamFeatureStatus owner tid "conferenceCalling" "enabled"

domain <- randomDomain

-- [customer admin] fetch tokens
tokens <- domainVerificationToken OwnDomain domain Nothing >>= getJSON 200
tokens <- domainVerificationTeamToken owner domain >>= getJSON 200
dnsToken <- tokens %. "dns_verification_token" & asString

-- [customer admin] register TXT DNS record
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,14 +566,11 @@ updateTeamInviteImpl luid domain config = do

guardTeamAdminAccess ::
forall r.
( Member (Input Endpoint) r,
Member TinyLog r,
( Member TinyLog r,
Member (Error EnterpriseLoginSubsystemError) r,
Member (Error ParseException) r,
Member UserSubsystem r,
Member GalleyAPIAccess r,
Member DomainRegistrationStore r,
Member Rpc r
Member DomainRegistrationStore r
) =>
Local UserId ->
Domain ->
Expand All @@ -588,7 +585,6 @@ guardTeamAdminAccess luid domain = do
unless (isAdminOrOwner (teamMember ^. permissions)) $
throw EnterpriseLoginSubsystemAuthFailure
mbDomainReg <- tryGetDomainRegistrationImpl domain
verifyDNSRecord domain (idToText tid)
pure (tid, mbDomainReg)
where
validatePaymentStatus :: TeamId -> Sem r ()
Expand Down

0 comments on commit fb921f3

Please sign in to comment.