Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

7 changes: 2 additions & 5 deletions integration/test/API/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -757,12 +757,9 @@ getTeamFeatures user tid = do
submit "GET" req

getTeamFeature :: (HasCallStack, MakesValue user, MakesValue tid) => user -> tid -> String -> App Response
getTeamFeature = getTeamFeatureVersioned Versioned

getTeamFeatureVersioned :: (HasCallStack, MakesValue user, MakesValue tid) => Versioned -> user -> tid -> String -> App Response
getTeamFeatureVersioned versioned user tid featureName = do
getTeamFeature user tid featureName = do
tidStr <- asString tid
req <- baseRequest user Galley versioned (joinHttpPath ["teams", tidStr, "features", featureName])
req <- baseRequest user Galley Versioned (joinHttpPath ["teams", tidStr, "features", featureName])
submit "GET" req

setTeamFeatureConfig ::
Expand Down
2 changes: 1 addition & 1 deletion integration/test/Test/FeatureFlags/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ defAllFeatures =
[ "legalhold" .= disabled,
"sso" .= disabled,
"searchVisibility" .= disabled,
"validateSAMLEmails" .= enabled,
"validateSAMLemails" .= enabled,
"digitalSignatures" .= disabled,
"appLock" .= defEnabledObj (object ["enforceAppLock" .= False, "inactivityTimeoutSecs" .= A.Number 60]),
"fileSharing" .= enabled,
Expand Down
6 changes: 3 additions & 3 deletions integration/test/Test/FeatureFlags/ValidateSAMLEmails.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import Testlib.Prelude

testPatchValidateSAMLEmails :: (HasCallStack) => App ()
testPatchValidateSAMLEmails =
checkPatch OwnDomain "validateSAMLEmails"
checkPatch OwnDomain "validateSAMLemails"
$ object ["status" .= "disabled"]

testValidateSAMLEmailsInternal :: (HasCallStack) => App ()
testValidateSAMLEmailsInternal = do
(alice, tid, _) <- createTeam OwnDomain 0
withWebSocket alice $ \ws -> do
setFlag InternalAPI ws tid "validateSAMLEmails" disabled
setFlag InternalAPI ws tid "validateSAMLEmails" enabled
setFlag InternalAPI ws tid "validateSAMLemails" disabled
setFlag InternalAPI ws tid "validateSAMLemails" enabled
12 changes: 4 additions & 8 deletions integration/test/Test/Spar.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module Test.Spar where
import API.Brig as Brig
import API.BrigInternal as BrigInternal
import API.Common (randomDomain, randomEmail, randomExternalId, randomHandle)
import API.Galley as Galley
import API.GalleyInternal (setTeamFeatureStatus)
import API.Spar
import API.SparInternal
Expand Down Expand Up @@ -455,11 +454,8 @@ testSsoLoginNoSamlEmailValidation (TaggedBool validateSAMLEmails) = do
(owner, tid, _) <- createTeam OwnDomain 1
emailDomain <- randomDomain

-- the old, inconsistent spelling still works:
assertSuccess =<< Galley.getTeamFeatureVersioned (ExplicitVersion 8) owner tid "validateSAMLemails"

let status = if validateSAMLEmails then "enabled" else "disabled"
assertSuccess =<< setTeamFeatureStatus owner tid "validateSAMLEmails" status
assertSuccess =<< setTeamFeatureStatus owner tid "validateSAMLemails" status

void $ setTeamFeatureStatus owner tid "sso" "enabled"
(idp, idpMeta) <- registerTestIdPWithMetaWithPrivateCreds owner
Expand Down Expand Up @@ -507,7 +503,7 @@ testScimUpdateEmailAddress (TaggedBool extIdIsEmail) (TaggedBool validateSAMLEma
(owner, tid, _) <- createTeam OwnDomain 1

let status = if validateSAMLEmails then "enabled" else "disabled"
assertSuccess =<< setTeamFeatureStatus owner tid "validateSAMLEmails" status
assertSuccess =<< setTeamFeatureStatus owner tid "validateSAMLemails" status

void $ setTeamFeatureStatus owner tid "sso" "enabled"
(idp, _) <- registerTestIdPWithMetaWithPrivateCreds owner
Expand Down Expand Up @@ -595,7 +591,7 @@ testScimUpdateEmailAddressAndExternalId = do
(owner, tid, _) <- createTeam OwnDomain 1

let status = "disabled"
assertSuccess =<< setTeamFeatureStatus owner tid "validateSAMLEmails" status
assertSuccess =<< setTeamFeatureStatus owner tid "validateSAMLemails" status

void $ setTeamFeatureStatus owner tid "sso" "enabled"
(idp, _) <- registerTestIdPWithMetaWithPrivateCreds owner
Expand Down Expand Up @@ -735,7 +731,7 @@ testScimLoginNoSamlEmailValidation (TaggedBool validateSAMLEmails) = do
(owner, tid, _) <- createTeam OwnDomain 1

let status = if validateSAMLEmails then "enabled" else "disabled"
assertSuccess =<< setTeamFeatureStatus owner tid "validateSAMLEmails" status
assertSuccess =<< setTeamFeatureStatus owner tid "validateSAMLemails" status

void $ setTeamFeatureStatus owner tid "sso" "enabled"
(idp, _) <- registerTestIdPWithMetaWithPrivateCreds owner
Expand Down
21 changes: 10 additions & 11 deletions libs/wire-api/src/Wire/API/Routes/Public/Galley/Feature.hs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ type family AllDeprecatedFeatureConfigAPI cfgs where
:<|> AllDeprecatedFeatureConfigAPI cfgs

type DeprecatedFeatureAPI =
FeatureStatusDeprecatedGet DeprecationNotice1 V2 SearchVisibilityAvailableConfig
:<|> FeatureStatusDeprecatedPut DeprecationNotice1 V2 SearchVisibilityAvailableConfig
:<|> FeatureStatusDeprecatedGet DeprecationNotice1 V2 ValidateSAMLEmailsConfig
:<|> FeatureStatusDeprecatedGet DeprecationNotice1 V9 ValidateSAMLEmailsConfig
:<|> FeatureStatusDeprecatedGet DeprecationNotice2 V2 DigitalSignaturesConfig
FeatureStatusDeprecatedGet DeprecationNotice1 SearchVisibilityAvailableConfig V2
Comment thread
supersven marked this conversation as resolved.
:<|> FeatureStatusDeprecatedPut DeprecationNotice1 SearchVisibilityAvailableConfig V2
:<|> FeatureStatusDeprecatedGet DeprecationNotice1 ValidateSAMLEmailsConfig V2
:<|> FeatureStatusDeprecatedGet DeprecationNotice2 DigitalSignaturesConfig V2

type FeatureAPIGet cfg =
Named
Expand All @@ -116,15 +115,15 @@ type FeatureAPIPut cfg =
:> FeatureStatusBasePutPublic cfg
)

type FeatureStatusDeprecatedGet d untilVersion feature =
type FeatureStatusDeprecatedGet d feature untilVersion =
Named
'("get-deprecated", '(feature, untilVersion))
(ZUser :> FeatureStatusBaseDeprecatedGet d untilVersion feature)
(ZUser :> FeatureStatusBaseDeprecatedGet d feature untilVersion)

type FeatureStatusDeprecatedPut d untilVersion feature =
type FeatureStatusDeprecatedPut d feature untilVersion =
Named
'("put-deprecated", '(feature, untilVersion))
(ZUser :> FeatureStatusBaseDeprecatedPut d untilVersion feature)
(ZUser :> FeatureStatusBaseDeprecatedPut d feature untilVersion)

type FeatureStatusBaseGet featureConfig =
Summary (AppendSymbol "Get config for " (FeatureSymbol featureConfig))
Expand Down Expand Up @@ -152,7 +151,7 @@ type FeatureStatusBasePutPublic featureConfig =
:> Put '[Servant.JSON] (LockableFeature featureConfig)

-- | A type for a GET endpoint for a feature with a deprecated path
type FeatureStatusBaseDeprecatedGet desc untilVersion featureConfig =
type FeatureStatusBaseDeprecatedGet desc featureConfig untilVersion =
( Summary
(AppendSymbol "[deprecated] Get config for " (FeatureSymbol featureConfig))
:> Until untilVersion
Expand All @@ -173,7 +172,7 @@ type FeatureStatusBaseDeprecatedGet desc untilVersion featureConfig =
)

-- | A type for a PUT endpoint for a feature with a deprecated path
type FeatureStatusBaseDeprecatedPut desc untilVersion featureConfig =
type FeatureStatusBaseDeprecatedPut desc featureConfig untilVersion =
Summary
(AppendSymbol "[deprecated] Get config for " (FeatureSymbol featureConfig))
:> Until untilVersion
Expand Down
4 changes: 1 addition & 3 deletions libs/wire-api/src/Wire/API/Team/Feature.hs
Original file line number Diff line number Diff line change
Expand Up @@ -691,14 +691,12 @@ instance Default (LockableFeature ValidateSAMLEmailsConfig) where
def = defUnlockedFeature

instance IsFeatureConfig ValidateSAMLEmailsConfig where
type FeatureSymbol ValidateSAMLEmailsConfig = "validateSAMLEmails"
type FeatureSymbol ValidateSAMLEmailsConfig = "validateSAMLemails"
featureSingleton = FeatureSingletonValidateSAMLEmailsConfig
objectSchema = pure ValidateSAMLEmailsConfig

type instance DeprecatedFeatureName V2 ValidateSAMLEmailsConfig = "validate-saml-emails"

type instance DeprecatedFeatureName V9 ValidateSAMLEmailsConfig = "validateSAMLemails"

--------------------------------------------------------------------------------
-- DigitalSignatures feature

Expand Down
1 change: 0 additions & 1 deletion services/galley/src/Galley/API/Public/Feature.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ deprecatedFeatureConfigAPI =
mkNamedAPI @'("get-deprecated", '(SearchVisibilityAvailableConfig, V2)) getFeature
<@> mkNamedAPI @'("put-deprecated", '(SearchVisibilityAvailableConfig, V2)) setFeature
<@> mkNamedAPI @'("get-deprecated", '(ValidateSAMLEmailsConfig, V2)) getFeature
<@> mkNamedAPI @'("get-deprecated", '(ValidateSAMLEmailsConfig, V9)) getFeature
<@> mkNamedAPI @'("get-deprecated", '(DigitalSignaturesConfig, V2)) getFeature

deprecatedFeatureAPI :: API (AllDeprecatedFeatureConfigAPI DeprecatedFeatureConfigs) GalleyEffects
Expand Down
2 changes: 1 addition & 1 deletion services/spar/src/Spar/Intra/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ assertSSOEnabled tid = do

isEmailValidationEnabledTeam :: (HasCallStack, MonadSparToGalley m) => TeamId -> m Bool
isEmailValidationEnabledTeam tid = do
resp <- call $ method GET . paths ["i", "teams", toByteString' tid, "features", "validateSAMLEmails"]
resp <- call $ method GET . paths ["i", "teams", toByteString' tid, "features", "validateSAMLemails"]
pure
( statusCode resp == 200
&& ( ((.status) <$> responseJsonMaybe @(LockableFeature ValidateSAMLEmailsConfig) resp)
Expand Down