Skip to content

Commit

Permalink
updated mlse2eid config and nwe api version
Browse files Browse the repository at this point in the history
  • Loading branch information
battermann committed May 17, 2024
1 parent f37c437 commit 003c9d0
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 5 deletions.
2 changes: 2 additions & 0 deletions libs/wire-api/src/Wire/API/Routes/Named.hs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ namedClient = clientIn (Proxy @endpoint) (Proxy @m)

type family x ::> api

infixr 4 ::>

type instance
x ::> (Named name api) =
Named name (x :> api)
3 changes: 2 additions & 1 deletion libs/wire-api/src/Wire/API/Routes/Public/Galley/Feature.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ type FeatureAPI =
:<|> FeatureStatusGet OutlookCalIntegrationConfig
:<|> FeatureStatusPut '[] '() OutlookCalIntegrationConfig
:<|> From 'V5 ::> FeatureStatusGet MlsE2EIdConfig
:<|> From 'V5 ::> FeatureStatusPut '[] '() MlsE2EIdConfig
:<|> From 'V5 ::> Until 'V6 ::> Named "put-MlsE2EIdConfig@v5" (ZUser :> FeatureStatusBasePutPublic '() MlsE2EIdConfig)
:<|> From 'V6 ::> FeatureStatusPut '[] '() MlsE2EIdConfig
:<|> From 'V5 ::> FeatureStatusGet MlsMigrationConfig
:<|> From 'V5 ::> FeatureStatusPut '[] '() MlsMigrationConfig
:<|> From 'V5
Expand Down
16 changes: 14 additions & 2 deletions libs/wire-api/src/Wire/API/Team/Feature.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ module Wire.API.Team.Feature
MLSConfig (..),
OutlookCalIntegrationConfig (..),
MlsE2EIdConfig (..),
MlsE2EIdConfigV5Symbol,
MlsMigrationConfig (..),
EnforceFileDownloadLocationConfig (..),
LimitedEventFanoutConfig (..),
Expand Down Expand Up @@ -1009,10 +1010,17 @@ instance FeatureTrivialConfig OutlookCalIntegrationConfig where

data MlsE2EIdConfig = MlsE2EIdConfig
{ verificationExpiration :: NominalDiffTime,
acmeDiscoveryUrl :: Maybe HttpsUrl
acmeDiscoveryUrl :: Maybe HttpsUrl,
crlProxy :: Maybe HttpsUrl,
useProxyOnMobile :: Bool
}
deriving stock (Eq, Show, Generic)

data MlsE2EIdConfigV5Symbol

instance RenderableSymbol MlsE2EIdConfigV5Symbol where
renderSymbol = "MlsE2EIdConfig@v5"

instance RenderableSymbol MlsE2EIdConfig where
renderSymbol = "MlsE2EIdConfig"

Expand All @@ -1021,6 +1029,8 @@ instance Arbitrary MlsE2EIdConfig where
MlsE2EIdConfig
<$> (fromIntegral <$> (arbitrary @Word32))
<*> arbitrary
<*> fmap Just arbitrary
<*> arbitrary

instance ToSchema MlsE2EIdConfig where
schema :: ValueSchema NamedSwaggerDoc MlsE2EIdConfig
Expand All @@ -1029,6 +1039,8 @@ instance ToSchema MlsE2EIdConfig where
MlsE2EIdConfig
<$> (toSeconds . verificationExpiration) .= fieldWithDocModifier "verificationExpiration" veDesc (fromSeconds <$> schema)
<*> acmeDiscoveryUrl .= maybe_ (optField "acmeDiscoveryUrl" schema)
<*> crlProxy .= maybe_ (optField "crlProxy" schema)
<*> useProxyOnMobile .= (fromMaybe False <$> optField "useProxyOnMobile" schema)
where
fromSeconds :: Int -> NominalDiffTime
fromSeconds = fromIntegral
Expand All @@ -1055,7 +1067,7 @@ instance IsFeatureConfig MlsE2EIdConfig where
type FeatureSymbol MlsE2EIdConfig = "mlsE2EId"
defFeatureStatus = withStatus FeatureStatusDisabled LockStatusUnlocked defValue FeatureTTLUnlimited
where
defValue = MlsE2EIdConfig (fromIntegral @Int (60 * 60 * 24)) Nothing
defValue = MlsE2EIdConfig (fromIntegral @Int (60 * 60 * 24)) Nothing Nothing False
featureSingleton = FeatureSingletonMlsE2EIdConfig
objectSchema = field "config" schema

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ testObject_WithStatus_team_18 =
( MlsE2EIdConfig
(fromIntegral @Int (60 * 60 * 24))
Nothing
Nothing
False
)

withStatus :: FeatureStatus -> LockStatus -> cfg -> WithStatus cfg
Expand Down
3 changes: 2 additions & 1 deletion libs/wire-api/test/golden/testObject_WithStatus_team_18.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"config": {
"verificationExpiration": 86400
"verificationExpiration": 86400,
"useProxyOnMobile": false
},
"lockStatus": "locked",
"status": "enabled",
Expand Down
1 change: 1 addition & 0 deletions services/galley/src/Galley/API/Public/Feature.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ featureAPI =
<@> mkNamedAPI @'("get", OutlookCalIntegrationConfig) (getFeatureStatus . DoAuth)
<@> mkNamedAPI @'("put", OutlookCalIntegrationConfig) (setFeatureStatus . DoAuth)
<@> mkNamedAPI @'("get", MlsE2EIdConfig) (getFeatureStatus . DoAuth)
<@> mkNamedAPI @"put-MlsE2EIdConfig@v5" (setFeatureStatus . DoAuth)
<@> mkNamedAPI @'("put", MlsE2EIdConfig) (setFeatureStatus . DoAuth)
<@> mkNamedAPI @'("get", MlsMigrationConfig) (getFeatureStatus . DoAuth)
<@> mkNamedAPI @'("put", MlsMigrationConfig) (setFeatureStatus . DoAuth)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ allFeatureConfigsFromRow ourteam allowListForExposeInvitationURLs featureLH hasT
MlsE2EIdConfig
(toGracePeriodOrDefault row.mlsE2eidGracePeriod)
row.mlsE2eidAcmeDiscoverUrl
(error "TODO:(leif)")
(error "TODO:(leif)")
where
toGracePeriodOrDefault :: Maybe Int32 -> NominalDiffTime
toGracePeriodOrDefault = maybe (verificationExpiration $ wsConfig defFeatureStatus) fromIntegral
Expand Down
3 changes: 2 additions & 1 deletion services/galley/src/Galley/Cassandra/TeamFeatures.hs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ getFeatureConfig FeatureSingletonMlsE2EIdConfig tid = do
fs
( -- FUTUREWORK: this block is duplicated in
-- "Galley.Cassandra.GetAllTeamFeatureConfigs"; make sure the two don't diverge!
MlsE2EIdConfig (toGracePeriodOrDefault mGracePeriod) mUrl
-- TODO(leif): implement the missing fields
MlsE2EIdConfig (toGracePeriodOrDefault mGracePeriod) mUrl Nothing False
)
FeatureTTLUnlimited
where
Expand Down

0 comments on commit 003c9d0

Please sign in to comment.