Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions changelog.d/2-features/pr-1811
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Per-account configuration of conference call initiation (details: /docs/reference/config-options.md#conference-calling-1)
1 change: 1 addition & 0 deletions docs/reference/cassandra-schema.cql
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,7 @@ CREATE TABLE brig_test.user (
country ascii,
email text,
expires timestamp,
feature_conference_calling int,
handle text,
language ascii,
managed_by int,
Expand Down
41 changes: 40 additions & 1 deletion docs/reference/config-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Fragment.
This page is about the yaml files that determine the configuration of
the Wire backend services.

## Settings
## Settings in galley

```
# [galley.yaml]
Expand Down Expand Up @@ -141,6 +141,8 @@ conferenceCalling:

The `conferenceCalling` section is optional in `featureFlags`. If it is omitted then it is assumed to be `enabled`.

See also: conference falling for personal accounts (below).

### File Sharing

File sharing is enabled by default. If you want to disable it for all teams, add this to your feature config settings:
Expand Down Expand Up @@ -270,3 +272,40 @@ federator:
clientCertificate: client.pem
clientPrivateKey: client-key.pem
```

## Settings in brig

Some features (as of the time of writing this: only
`conferenceCalling`) allow to set defaults for personal accounts in
brig. Those are taken into account in galley's end-points `GET
/feature-configs*`.

To be specific:

### Conference Calling

Two values can be configured for personal accounts: a default for when
the user record contains `null` as feature config, and default that
should be inserted into the user record when creating new users:

```
# [brig.yaml]
settings:
setFeatureFlags:
conferenceCalling:
defaultForNew:
status: disabled
defaultForNull:
status: enabled
```

You can omit the entire `conferenceCalling` block, but not parts of
it. Built-in defaults are as above.

When new users are created, their config will be initialized with
what's in `defaultForNew`.

When a `null` value is encountered, it is assumed to be
`defaultForNull`.

(Introduced in https://github.com/wireapp/wire-server/pull/1811.)
3 changes: 1 addition & 2 deletions libs/brig-types/brig-types.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 2b3c91a37e09e61ca32cf32ab80c46e8f019926c78165bec82d9c84a5b8d20a6
-- hash: 42d648b07cd5a5d45e2ca36fd4631c37047fc74aea88fce77073a3efa99327a2

name: brig-types
version: 1.35.0
Expand Down Expand Up @@ -40,7 +40,6 @@ library
Brig.Types.Test.Arbitrary
Brig.Types.User
Brig.Types.User.Auth
Brig.Types.User.EJPD
Brig.Types.User.Event
other-modules:
Paths_brig_types
Expand Down
2 changes: 1 addition & 1 deletion libs/brig-types/test/unit/Test/Brig/Types/User.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ module Test.Brig.Types.User where
import Brig.Types.Connection (UpdateConnectionsInternal (..))
import Brig.Types.Intra (NewUserScimInvitation (..), ReAuthUser (..))
import Brig.Types.User (ManagedByUpdate (..), RichInfoUpdate (..))
import Brig.Types.User.EJPD (EJPDRequestBody (..), EJPDResponseBody (..))
import Imports
import Test.Brig.Roundtrip (testRoundTrip, testRoundTripWithSwagger)
import Test.QuickCheck (Arbitrary (arbitrary))
import Test.Tasty
import Wire.API.Routes.Internal.Brig.EJPD (EJPDRequestBody (..), EJPDResponseBody (..))

tests :: TestTree
tests = testGroup "User (types vs. aeson)" $ roundtripTests
Expand Down
1 change: 1 addition & 0 deletions libs/wire-api/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies:
- containers >=0.5
- imports
- types-common >=0.16
- servant-swagger-ui
- case-insensitive
- hscim
library:
Expand Down
97 changes: 97 additions & 0 deletions libs/wire-api/src/Wire/API/Routes/Internal/Brig.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
-- This file is part of the Wire Server implementation.
--
-- Copyright (C) 2020 Wire Swiss GmbH <[email protected]>
--
-- This program is free software: you can redistribute it and/or modify it under
-- the terms of the GNU Affero General Public License as published by the Free
-- Software Foundation, either version 3 of the License, or (at your option) any
-- later version.
--
-- This program is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
-- details.
--
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module Wire.API.Routes.Internal.Brig
( API,
SwaggerDocsAPI,
swaggerDoc,
module Wire.API.Routes.Internal.Brig.EJPD,
)
where

import Control.Lens ((.~))
import Data.Id as Id
import Data.Swagger (HasInfo (info), HasTitle (title), Swagger)
import Imports hiding (head)
import Servant hiding (Handler, JSON, addHeader, respond)
import qualified Servant
import Servant.Swagger (HasSwagger (toSwagger))
import Servant.Swagger.Internal.Orphans ()
import Servant.Swagger.UI
import Wire.API.Routes.Internal.Brig.EJPD
import qualified Wire.API.Team.Feature as ApiFt

type EJPDRequest =
Summary
"Identify users for law enforcement. Wire has legal requirements to cooperate \
\with the authorities. The wire backend operations team uses this to answer \
\identification requests manually. It is our best-effort representation of the \
\minimum required information we need to hand over about targets and (in some \
\cases) their communication peers. For more information, consult ejpd.admin.ch."
:> "ejpd-request"
:> QueryParam'
[ Optional,
Strict,
Description "Also provide information about all contacts of the identified users"
]
"include_contacts"
Bool
:> Servant.ReqBody '[Servant.JSON] EJPDRequestBody
:> Post '[Servant.JSON] EJPDResponseBody

type GetAccountFeatureConfig =
Summary
"Read cassandra field 'brig.user.feature_conference_calling'"
:> "users"
:> Capture "uid" UserId
:> "features"
:> "conferenceCalling"
:> Get '[Servant.JSON] (ApiFt.TeamFeatureStatus 'ApiFt.TeamFeatureConferenceCalling)

type PutAccountFeatureConfig =
Summary
"Write to cassandra field 'brig.user.feature_conference_calling'"
:> "users"
:> Capture "uid" UserId
:> "features"
:> "conferenceCalling"
:> Servant.ReqBody '[Servant.JSON] (ApiFt.TeamFeatureStatus 'ApiFt.TeamFeatureConferenceCalling)
:> Put '[Servant.JSON] NoContent

type DeleteAccountFeatureConfig =
Summary
"Reset cassandra field 'brig.user.feature_conference_calling' to 'null'"
:> "users"
:> Capture "uid" UserId
:> "features"
:> "conferenceCalling"
:> Delete '[Servant.JSON] NoContent

type API =
"i"
:> ( EJPDRequest
:<|> GetAccountFeatureConfig
:<|> PutAccountFeatureConfig
:<|> DeleteAccountFeatureConfig
)

type SwaggerDocsAPI = "api" :> "internal" :> SwaggerSchemaUI "swagger-ui" "swagger.json"

swaggerDoc :: Swagger
swaggerDoc =
toSwagger (Proxy @API)
& info . title .~ "Wire-Server API as Swagger 2.0 (internal end-points; incomplete) "
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
-- | Identify users for law enforcement. (Wire has legal requirements to cooperate with the
-- authorities. The wire backend operations team uses this to answer identification requests
-- manually.)
module Brig.Types.User.EJPD
module Wire.API.Routes.Internal.Brig.EJPD
( EJPDRequestBody (EJPDRequestBody, ejpdRequestBody),
EJPDResponseBody (EJPDResponseBody, ejpdResponseBody),
EJPDResponseItem (EJPDResponseItem, ejpdResponseHandle, ejpdResponsePushTokens, ejpdResponseContacts),
Expand Down
13 changes: 13 additions & 0 deletions libs/wire-api/src/Wire/API/Team/Feature.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module Wire.API.Team.Feature
)
where

import qualified Cassandra.CQL as Cass
import Control.Lens.Combinators (dimap)
import qualified Data.Aeson as Aeson
import qualified Data.Attoparsec.ByteString as Parser
Expand Down Expand Up @@ -254,6 +255,18 @@ instance FromByteString TeamFeatureStatusValue where
Right t -> fail $ "Invalid TeamFeatureStatusValue: " <> T.unpack t
Left e -> fail $ "Invalid TeamFeatureStatusValue: " <> show e

instance Cass.Cql TeamFeatureStatusValue where
ctype = Cass.Tagged Cass.IntColumn

fromCql (Cass.CqlInt n) = case n of
0 -> pure $ TeamFeatureDisabled
1 -> pure $ TeamFeatureEnabled
_ -> Left "fromCql: Invalid TeamFeatureStatusValue"
fromCql _ = Left "fromCql: TeamFeatureStatusValue: CqlInt expected"

toCql TeamFeatureDisabled = Cass.CqlInt 0
toCql TeamFeatureEnabled = Cass.CqlInt 1

----------------------------------------------------------------------
-- TeamFeatureStatus

Expand Down
6 changes: 5 additions & 1 deletion libs/wire-api/wire-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: ec0f1e0e3e31d5771b93db6b6ee37ad444f98c3213696e98bbedbb4b1bb56c8c
-- hash: 9d49a92f6ad563b050a6e3e6ae7f68b8abda7fa71e1986573cd81edf97d7b508

name: wire-api
version: 0.1.0
Expand Down Expand Up @@ -49,6 +49,8 @@ library
Wire.API.Provider.Service.Tag
Wire.API.Push.Token
Wire.API.Push.V2.Token
Wire.API.Routes.Internal.Brig
Wire.API.Routes.Internal.Brig.EJPD
Wire.API.Routes.MultiTablePaging
Wire.API.Routes.MultiTablePaging.State
Wire.API.Routes.MultiVerb
Expand Down Expand Up @@ -152,6 +154,7 @@ library
, servant-multipart
, servant-server
, servant-swagger
, servant-swagger-ui
, singletons
, sop-core
, string-conversions
Expand Down Expand Up @@ -450,6 +453,7 @@ test-suite wire-api-tests
, pem
, pretty
, proto-lens
, servant-swagger-ui
, string-conversions
, swagger2
, tasty
Expand Down
7 changes: 6 additions & 1 deletion services/brig/brig.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 40cef77c160c1ffa8500043f465ab4ee307cf751450745d55010ef637b03b152
-- hash: d5382afdfc45e225067c7848e99d40349897ddd6eeb69be59038373e57ada716

name: brig
version: 1.35.0
Expand Down Expand Up @@ -268,6 +268,7 @@ executable brig-integration
API.Calling
API.Federation
API.Internal
API.Internal.Util
API.Metrics
API.Provider
API.RichInfo.Util
Expand Down Expand Up @@ -318,6 +319,7 @@ executable brig-integration
, cassandra-util
, containers
, cookie
, cql-io
, data-timeout
, email-validate
, exceptions
Expand Down Expand Up @@ -436,6 +438,7 @@ executable brig-schema
V63_AddUsersPendingActivation
V64_ClientCapabilities
V65_FederatedConnections
V66_PersonalFeatureConfCallInit
V9
Paths_brig
hs-source-dirs:
Expand All @@ -461,6 +464,7 @@ test-suite brig-tests
Test.Brig.API.Error
Test.Brig.Calling
Test.Brig.Calling.Internal
Test.Brig.Roundtrip
Test.Brig.User.Search.Index.Types
Paths_brig
hs-source-dirs:
Expand All @@ -484,6 +488,7 @@ test-suite brig-tests
, servant-client-core
, tasty
, tasty-hunit
, tasty-quickcheck
, time
, tinylog
, types-common
Expand Down
1 change: 1 addition & 0 deletions services/brig/brig.integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ optSettings:
# Once set, DO NOT change it: if you do, existing users may have a broken experience and/or stop working
# Remember to keep it the same in Galley.
setFederationDomain: example.com
setFeatureFlags: # see #RefConfigOptions in `/docs/reference`

logLevel: Warn
# ^ NOTE: We log too much in brig, if we set this to Info like other services, running tests
Expand Down
2 changes: 2 additions & 0 deletions services/brig/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ tests:
- servant-client-core
- tasty
- tasty-hunit
- tasty-quickcheck
- time
- tinylog
- types-common
Expand Down Expand Up @@ -197,6 +198,7 @@ executables:
- cassandra-util
- containers
- cookie
- cql-io
- data-timeout
- email-validate
- exceptions
Expand Down
4 changes: 3 additions & 1 deletion services/brig/schema/src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import qualified V62_RemoveFederationIdMapping
import qualified V63_AddUsersPendingActivation
import qualified V64_ClientCapabilities
import qualified V65_FederatedConnections
import qualified V66_PersonalFeatureConfCallInit
import qualified V9

main :: IO ()
Expand Down Expand Up @@ -139,7 +140,8 @@ main = do
V62_RemoveFederationIdMapping.migration,
V63_AddUsersPendingActivation.migration,
V64_ClientCapabilities.migration,
V65_FederatedConnections.migration
V65_FederatedConnections.migration,
V66_PersonalFeatureConfCallInit.migration
-- When adding migrations here, don't forget to update
-- 'schemaVersion' in Brig.App

Expand Down
32 changes: 32 additions & 0 deletions services/brig/schema/src/V66_PersonalFeatureConfCallInit.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}

-- This file is part of the Wire Server implementation.
--
-- Copyright (C) 2020 Wire Swiss GmbH <[email protected]>
--
-- This program is free software: you can redistribute it and/or modify it under
-- the terms of the GNU Affero General Public License as published by the Free
-- Software Foundation, either version 3 of the License, or (at your option) any
-- later version.
--
-- This program is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
-- details.
--
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module V66_PersonalFeatureConfCallInit
( migration,
)
where

import Cassandra.Schema
import Imports
import Text.RawString.QQ

migration :: Migration
migration = Migration 66 "Add personal account feature: conf call initiation" $ do
schema' [r| ALTER TABLE user ADD feature_conference_calling int; |]
Loading