diff --git a/CHANGELOG.md b/CHANGELOG.md index f22d8c4e3cc..8866bb6c35c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# 2019-02-18 #646 + +## API changes + + * n/a + +## Bug fixes + + * SAML input sanitization (#636) + +## Internal changes + + * helper script for starting services only without integration tests (#641) + * Scim error handling (#640) + * Gundeck: cleanup, improve logging (#628) + + # 2019-02-18 #634 ## API changes diff --git a/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs b/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs index 07d6795590e..1b654413773 100644 --- a/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs +++ b/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs @@ -78,7 +78,7 @@ data Route -- trigger native pushes if the web socket is unavaiable, but they are stored in -- cassandra for later pickup. | RouteNative -- ^ REFACTOR: this can probably be removed. - deriving (Eq, Ord, Show) + deriving (Eq, Ord, Enum, Bounded, Show) instance FromJSON Route where parseJSON (String "any") = return RouteAny diff --git a/services/brig/index/src/Main.hs b/services/brig/index/src/Main.hs index 89c6b7ed132..1d1e301e7db 100644 --- a/services/brig/index/src/Main.hs +++ b/services/brig/index/src/Main.hs @@ -1,4 +1,3 @@ - module Main (main) where import Imports diff --git a/services/brig/schema/src/Main.hs b/services/brig/schema/src/Main.hs index 3e5263b2c0a..c13885e5df0 100644 --- a/services/brig/schema/src/Main.hs +++ b/services/brig/schema/src/Main.hs @@ -1,4 +1,3 @@ - module Main where import Imports diff --git a/services/brig/schema/src/V10.hs b/services/brig/schema/src/V10.hs index 4b5369c53f2..0c45e192c63 100644 --- a/services/brig/schema/src/V10.hs +++ b/services/brig/schema/src/V10.hs @@ -1,4 +1,3 @@ - module V10 (migration) where import Imports diff --git a/services/brig/schema/src/V11.hs b/services/brig/schema/src/V11.hs index 6fcef7b85cc..c2ec8ff41ab 100644 --- a/services/brig/schema/src/V11.hs +++ b/services/brig/schema/src/V11.hs @@ -1,4 +1,3 @@ - module V11 (migration) where import Imports diff --git a/services/brig/schema/src/V12.hs b/services/brig/schema/src/V12.hs index 571e00d457a..8ab139542cd 100644 --- a/services/brig/schema/src/V12.hs +++ b/services/brig/schema/src/V12.hs @@ -1,4 +1,3 @@ - module V12 (migration) where import Imports diff --git a/services/brig/schema/src/V13.hs b/services/brig/schema/src/V13.hs index 6027446d9a5..117b2c8072c 100644 --- a/services/brig/schema/src/V13.hs +++ b/services/brig/schema/src/V13.hs @@ -1,4 +1,3 @@ - module V13 (migration) where import Imports diff --git a/services/brig/schema/src/V14.hs b/services/brig/schema/src/V14.hs index 7cc9a41f18d..287f14ff2ce 100644 --- a/services/brig/schema/src/V14.hs +++ b/services/brig/schema/src/V14.hs @@ -1,4 +1,3 @@ - module V14 (migration) where import Imports diff --git a/services/brig/schema/src/V15.hs b/services/brig/schema/src/V15.hs index 59ace685af5..98ce7eecb1c 100644 --- a/services/brig/schema/src/V15.hs +++ b/services/brig/schema/src/V15.hs @@ -1,4 +1,3 @@ - module V15 (migration) where import Imports diff --git a/services/brig/schema/src/V16.hs b/services/brig/schema/src/V16.hs index de6f7720266..c5e4cc2bed0 100644 --- a/services/brig/schema/src/V16.hs +++ b/services/brig/schema/src/V16.hs @@ -1,4 +1,3 @@ - module V16 (migration) where import Imports diff --git a/services/brig/schema/src/V17.hs b/services/brig/schema/src/V17.hs index 73602aff34a..b1b12f49b18 100644 --- a/services/brig/schema/src/V17.hs +++ b/services/brig/schema/src/V17.hs @@ -1,4 +1,3 @@ - module V17 (migration) where import Imports diff --git a/services/brig/schema/src/V18.hs b/services/brig/schema/src/V18.hs index fe3c5a93764..bad4b7efdb8 100644 --- a/services/brig/schema/src/V18.hs +++ b/services/brig/schema/src/V18.hs @@ -1,4 +1,3 @@ - module V18 (migration) where import Imports diff --git a/services/brig/schema/src/V19.hs b/services/brig/schema/src/V19.hs index 8111c39e349..98db99c5424 100644 --- a/services/brig/schema/src/V19.hs +++ b/services/brig/schema/src/V19.hs @@ -1,4 +1,3 @@ - module V19 (migration) where import Imports diff --git a/services/brig/schema/src/V20.hs b/services/brig/schema/src/V20.hs index df6db61bb3e..8665ca63bb9 100644 --- a/services/brig/schema/src/V20.hs +++ b/services/brig/schema/src/V20.hs @@ -1,4 +1,3 @@ - module V20 (migration) where import Imports diff --git a/services/brig/schema/src/V21.hs b/services/brig/schema/src/V21.hs index 312bc9e3d1b..0f2aa8fd06b 100644 --- a/services/brig/schema/src/V21.hs +++ b/services/brig/schema/src/V21.hs @@ -1,4 +1,3 @@ - module V21 (migration) where import Imports diff --git a/services/brig/schema/src/V22.hs b/services/brig/schema/src/V22.hs index 2ae00b0446d..6ca4c4d4fba 100644 --- a/services/brig/schema/src/V22.hs +++ b/services/brig/schema/src/V22.hs @@ -1,4 +1,3 @@ - module V22 (migration) where import Imports diff --git a/services/brig/schema/src/V23.hs b/services/brig/schema/src/V23.hs index b3924d51c11..1eb9343f026 100644 --- a/services/brig/schema/src/V23.hs +++ b/services/brig/schema/src/V23.hs @@ -1,4 +1,3 @@ - module V23 (migration) where import Imports diff --git a/services/brig/schema/src/V24.hs b/services/brig/schema/src/V24.hs index 408c7e5a5df..773fda35c93 100644 --- a/services/brig/schema/src/V24.hs +++ b/services/brig/schema/src/V24.hs @@ -1,4 +1,3 @@ - module V24 (migration) where import Imports diff --git a/services/brig/schema/src/V25.hs b/services/brig/schema/src/V25.hs index 5a4ba41e144..1e1447595ac 100644 --- a/services/brig/schema/src/V25.hs +++ b/services/brig/schema/src/V25.hs @@ -1,4 +1,3 @@ - module V25 (migration) where import Imports diff --git a/services/brig/schema/src/V28.hs b/services/brig/schema/src/V28.hs index 3d44629ff43..ce24d41d230 100644 --- a/services/brig/schema/src/V28.hs +++ b/services/brig/schema/src/V28.hs @@ -1,4 +1,3 @@ - module V28 (migration) where import Imports diff --git a/services/brig/schema/src/V29.hs b/services/brig/schema/src/V29.hs index 146840f9c21..028fac19442 100644 --- a/services/brig/schema/src/V29.hs +++ b/services/brig/schema/src/V29.hs @@ -1,4 +1,3 @@ - module V29 (migration) where import Imports diff --git a/services/brig/schema/src/V30.hs b/services/brig/schema/src/V30.hs index 8b9c02d6b35..b3b80c828a2 100644 --- a/services/brig/schema/src/V30.hs +++ b/services/brig/schema/src/V30.hs @@ -1,4 +1,3 @@ - module V30 (migration) where import Imports diff --git a/services/brig/schema/src/V31.hs b/services/brig/schema/src/V31.hs index 6f0a6e95ddc..62a74da3c97 100644 --- a/services/brig/schema/src/V31.hs +++ b/services/brig/schema/src/V31.hs @@ -1,4 +1,3 @@ - module V31 (migration) where import Imports diff --git a/services/brig/schema/src/V32.hs b/services/brig/schema/src/V32.hs index d86afbabeb5..76c80c00074 100644 --- a/services/brig/schema/src/V32.hs +++ b/services/brig/schema/src/V32.hs @@ -1,4 +1,3 @@ - module V32 (migration) where import Imports diff --git a/services/brig/schema/src/V33.hs b/services/brig/schema/src/V33.hs index 05949e57022..4bf04034d62 100644 --- a/services/brig/schema/src/V33.hs +++ b/services/brig/schema/src/V33.hs @@ -1,4 +1,3 @@ - module V33 (migration) where import Imports diff --git a/services/brig/schema/src/V34.hs b/services/brig/schema/src/V34.hs index daf203d42f4..1b1d5dd4da7 100644 --- a/services/brig/schema/src/V34.hs +++ b/services/brig/schema/src/V34.hs @@ -1,4 +1,3 @@ - module V34 (migration) where import Imports diff --git a/services/brig/schema/src/V35.hs b/services/brig/schema/src/V35.hs index fa122529d78..b4cc6316929 100644 --- a/services/brig/schema/src/V35.hs +++ b/services/brig/schema/src/V35.hs @@ -1,4 +1,3 @@ - module V35 (migration) where import Imports diff --git a/services/brig/schema/src/V36.hs b/services/brig/schema/src/V36.hs index 662d0734a49..62aa148d274 100644 --- a/services/brig/schema/src/V36.hs +++ b/services/brig/schema/src/V36.hs @@ -1,4 +1,3 @@ - module V36 (migration) where import Imports diff --git a/services/brig/schema/src/V37.hs b/services/brig/schema/src/V37.hs index c9b56f76ab8..e6fa5bcf783 100644 --- a/services/brig/schema/src/V37.hs +++ b/services/brig/schema/src/V37.hs @@ -1,4 +1,3 @@ - module V37 (migration) where import Imports diff --git a/services/brig/schema/src/V38.hs b/services/brig/schema/src/V38.hs index 4e6254fd2aa..47021b4bf41 100644 --- a/services/brig/schema/src/V38.hs +++ b/services/brig/schema/src/V38.hs @@ -1,4 +1,3 @@ - module V38 (migration) where import Imports diff --git a/services/brig/schema/src/V39.hs b/services/brig/schema/src/V39.hs index 34d1d2eefaf..951fa291aed 100644 --- a/services/brig/schema/src/V39.hs +++ b/services/brig/schema/src/V39.hs @@ -1,4 +1,3 @@ - module V39 (migration) where import Imports diff --git a/services/brig/schema/src/V40.hs b/services/brig/schema/src/V40.hs index fe5fde83f5c..b05418ca1f2 100644 --- a/services/brig/schema/src/V40.hs +++ b/services/brig/schema/src/V40.hs @@ -1,4 +1,3 @@ - module V40 (migration) where import Imports diff --git a/services/brig/schema/src/V41.hs b/services/brig/schema/src/V41.hs index ba9b24f1444..71765b01d49 100644 --- a/services/brig/schema/src/V41.hs +++ b/services/brig/schema/src/V41.hs @@ -1,4 +1,3 @@ - module V41 (migration) where import Imports diff --git a/services/brig/schema/src/V42.hs b/services/brig/schema/src/V42.hs index 68ed768925a..0888ca28729 100644 --- a/services/brig/schema/src/V42.hs +++ b/services/brig/schema/src/V42.hs @@ -1,4 +1,3 @@ - module V42 (migration) where import Imports diff --git a/services/brig/schema/src/V43.hs b/services/brig/schema/src/V43.hs index 07e293624aa..cd30b234d65 100644 --- a/services/brig/schema/src/V43.hs +++ b/services/brig/schema/src/V43.hs @@ -1,4 +1,3 @@ - module V43 (migration) where import Imports diff --git a/services/brig/schema/src/V44.hs b/services/brig/schema/src/V44.hs index deda72f58f1..a23ed4c8bee 100644 --- a/services/brig/schema/src/V44.hs +++ b/services/brig/schema/src/V44.hs @@ -1,4 +1,3 @@ - module V44 (migration) where import Imports diff --git a/services/brig/schema/src/V45.hs b/services/brig/schema/src/V45.hs index 49a1b3a9ebe..63dc40f1537 100644 --- a/services/brig/schema/src/V45.hs +++ b/services/brig/schema/src/V45.hs @@ -1,4 +1,3 @@ - module V45 (migration) where import Imports diff --git a/services/brig/schema/src/V46.hs b/services/brig/schema/src/V46.hs index 66b2faec1f2..ba371eaaeee 100644 --- a/services/brig/schema/src/V46.hs +++ b/services/brig/schema/src/V46.hs @@ -1,4 +1,3 @@ - module V46 (migration) where import Imports diff --git a/services/brig/schema/src/V47.hs b/services/brig/schema/src/V47.hs index b41f16aab33..6d2a0b52672 100644 --- a/services/brig/schema/src/V47.hs +++ b/services/brig/schema/src/V47.hs @@ -1,4 +1,3 @@ - module V47 (migration) where import Imports diff --git a/services/brig/schema/src/V48.hs b/services/brig/schema/src/V48.hs index 6790455bba7..fa946979ab7 100644 --- a/services/brig/schema/src/V48.hs +++ b/services/brig/schema/src/V48.hs @@ -1,4 +1,3 @@ - module V48 (migration) where import Imports diff --git a/services/brig/schema/src/V49.hs b/services/brig/schema/src/V49.hs index 10e093a5c8c..7724642adb0 100644 --- a/services/brig/schema/src/V49.hs +++ b/services/brig/schema/src/V49.hs @@ -1,4 +1,3 @@ - module V49 (migration) where import Imports diff --git a/services/brig/schema/src/V50.hs b/services/brig/schema/src/V50.hs index 350071b921d..bc1b93bbb50 100644 --- a/services/brig/schema/src/V50.hs +++ b/services/brig/schema/src/V50.hs @@ -1,4 +1,3 @@ - module V50 (migration) where import Imports diff --git a/services/brig/schema/src/V51.hs b/services/brig/schema/src/V51.hs index 1ed9f299dd0..4052137f78c 100644 --- a/services/brig/schema/src/V51.hs +++ b/services/brig/schema/src/V51.hs @@ -1,4 +1,3 @@ - module V51 (migration) where import Imports diff --git a/services/brig/schema/src/V52.hs b/services/brig/schema/src/V52.hs index 5627f5f49ea..43f347445a8 100644 --- a/services/brig/schema/src/V52.hs +++ b/services/brig/schema/src/V52.hs @@ -1,4 +1,3 @@ - module V52 (migration) where import Imports diff --git a/services/brig/schema/src/V53.hs b/services/brig/schema/src/V53.hs index f116e5345ec..7e98078aca7 100644 --- a/services/brig/schema/src/V53.hs +++ b/services/brig/schema/src/V53.hs @@ -1,4 +1,3 @@ - module V53 (migration) where import Imports diff --git a/services/brig/schema/src/V54.hs b/services/brig/schema/src/V54.hs index c8fe13d5d7e..b096a5fe42c 100644 --- a/services/brig/schema/src/V54.hs +++ b/services/brig/schema/src/V54.hs @@ -1,4 +1,3 @@ - module V54 (migration) where import Imports diff --git a/services/brig/schema/src/V55.hs b/services/brig/schema/src/V55.hs index 8ca83e31769..a6fcbab333d 100644 --- a/services/brig/schema/src/V55.hs +++ b/services/brig/schema/src/V55.hs @@ -1,4 +1,3 @@ - module V55 (migration) where import Imports diff --git a/services/brig/schema/src/V9.hs b/services/brig/schema/src/V9.hs index 249cbe79bf3..359cc9cdc7b 100644 --- a/services/brig/schema/src/V9.hs +++ b/services/brig/schema/src/V9.hs @@ -1,4 +1,3 @@ - module V9 (migration) where import Imports diff --git a/services/brig/src/Brig/API/Client.hs b/services/brig/src/Brig/API/Client.hs index 0f4cd8988c2..38dab36f4f6 100644 --- a/services/brig/src/Brig/API/Client.hs +++ b/services/brig/src/Brig/API/Client.hs @@ -1,4 +1,3 @@ - -- TODO: Move to Brig.User.Client module Brig.API.Client ( -- * Clients diff --git a/services/brig/src/Brig/API/Error.hs b/services/brig/src/Brig/API/Error.hs index 423dbe0b921..aab60bbee1b 100644 --- a/services/brig/src/Brig/API/Error.hs +++ b/services/brig/src/Brig/API/Error.hs @@ -1,4 +1,3 @@ - module Brig.API.Error where import Imports diff --git a/services/brig/src/Brig/API/Handler.hs b/services/brig/src/Brig/API/Handler.hs index 2a99ace6928..83d160e8ed5 100644 --- a/services/brig/src/Brig/API/Handler.hs +++ b/services/brig/src/Brig/API/Handler.hs @@ -1,4 +1,3 @@ - module Brig.API.Handler ( -- * Handler Monad Handler diff --git a/services/brig/src/Brig/AWS/SesNotification.hs b/services/brig/src/Brig/AWS/SesNotification.hs index 42fda49a3d3..4e689ad7881 100644 --- a/services/brig/src/Brig/AWS/SesNotification.hs +++ b/services/brig/src/Brig/AWS/SesNotification.hs @@ -1,4 +1,3 @@ - module Brig.AWS.SesNotification(onEvent) where import Imports diff --git a/services/brig/src/Brig/AWS/Types.hs b/services/brig/src/Brig/AWS/Types.hs index 1af29f4bab7..67983bf711e 100644 --- a/services/brig/src/Brig/AWS/Types.hs +++ b/services/brig/src/Brig/AWS/Types.hs @@ -1,4 +1,3 @@ - module Brig.AWS.Types ( -- * SES Notification SESNotification (..) diff --git a/services/brig/src/Brig/Data/Activation.hs b/services/brig/src/Brig/Data/Activation.hs index eba20238f6d..b00c20092b2 100644 --- a/services/brig/src/Brig/Data/Activation.hs +++ b/services/brig/src/Brig/Data/Activation.hs @@ -1,4 +1,3 @@ - -- | Activation of 'Email' addresses and 'Phone' numbers. module Brig.Data.Activation ( Activation (..) diff --git a/services/brig/src/Brig/Data/Blacklist.hs b/services/brig/src/Brig/Data/Blacklist.hs index aa76dbf9d7a..c0716c30755 100644 --- a/services/brig/src/Brig/Data/Blacklist.hs +++ b/services/brig/src/Brig/Data/Blacklist.hs @@ -1,4 +1,3 @@ - module Brig.Data.Blacklist ( -- * UserKey blacklisting insert diff --git a/services/brig/src/Brig/Data/Client.hs b/services/brig/src/Brig/Data/Client.hs index 2757fab8a87..f4deff22403 100644 --- a/services/brig/src/Brig/Data/Client.hs +++ b/services/brig/src/Brig/Data/Client.hs @@ -1,4 +1,3 @@ - module Brig.Data.Client ( -- * Clients ClientDataError (..) diff --git a/services/brig/src/Brig/Data/LoginCode.hs b/services/brig/src/Brig/Data/LoginCode.hs index d35cbb4c519..9ac249c9924 100644 --- a/services/brig/src/Brig/Data/LoginCode.hs +++ b/services/brig/src/Brig/Data/LoginCode.hs @@ -1,4 +1,3 @@ - -- | Persistent storage for login codes. -- TODO: Use Brig.Data.Codes -- TODO: Move to Brig.User.Auth.DB.LoginCode diff --git a/services/brig/src/Brig/Data/PasswordReset.hs b/services/brig/src/Brig/Data/PasswordReset.hs index 41d27d07741..2089cebee48 100644 --- a/services/brig/src/Brig/Data/PasswordReset.hs +++ b/services/brig/src/Brig/Data/PasswordReset.hs @@ -1,4 +1,3 @@ - -- | Persistent storage for password reset codes. -- TODO: Use Brig.Data.Codes module Brig.Data.PasswordReset diff --git a/services/brig/src/Brig/Data/Properties.hs b/services/brig/src/Brig/Data/Properties.hs index ed0872b7ba9..f856cfdc168 100644 --- a/services/brig/src/Brig/Data/Properties.hs +++ b/services/brig/src/Brig/Data/Properties.hs @@ -1,4 +1,3 @@ - module Brig.Data.Properties ( PropertiesDataError (..) , insertProperty diff --git a/services/brig/src/Brig/Email.hs b/services/brig/src/Brig/Email.hs index b6eaf49f7cb..7553a41679b 100644 --- a/services/brig/src/Brig/Email.hs +++ b/services/brig/src/Brig/Email.hs @@ -1,4 +1,3 @@ - module Brig.Email ( -- * Validation validateEmail diff --git a/services/brig/src/Brig/InternalEvent/Process.hs b/services/brig/src/Brig/InternalEvent/Process.hs index 20ee78e0987..16054a20715 100644 --- a/services/brig/src/Brig/InternalEvent/Process.hs +++ b/services/brig/src/Brig/InternalEvent/Process.hs @@ -1,4 +1,3 @@ - module Brig.InternalEvent.Process ( onEvent ) where diff --git a/services/brig/src/Brig/InternalEvent/Types.hs b/services/brig/src/Brig/InternalEvent/Types.hs index dd2be69236e..6e5a97f4c01 100644 --- a/services/brig/src/Brig/InternalEvent/Types.hs +++ b/services/brig/src/Brig/InternalEvent/Types.hs @@ -1,4 +1,3 @@ - module Brig.InternalEvent.Types ( InternalNotification(..) ) where diff --git a/services/brig/src/Brig/Password.hs b/services/brig/src/Brig/Password.hs index 7397d6be2d8..45730b2286a 100644 --- a/services/brig/src/Brig/Password.hs +++ b/services/brig/src/Brig/Password.hs @@ -1,4 +1,3 @@ - module Brig.Password ( Password , genPassword diff --git a/services/brig/src/Brig/Provider/API.hs b/services/brig/src/Brig/Provider/API.hs index 0a11026eb90..cbd59381e50 100644 --- a/services/brig/src/Brig/Provider/API.hs +++ b/services/brig/src/Brig/Provider/API.hs @@ -1,4 +1,3 @@ - module Brig.Provider.API ( -- * Main stuff routes diff --git a/services/brig/src/Brig/Provider/DB.hs b/services/brig/src/Brig/Provider/DB.hs index 6877f4c80e9..4618585108c 100644 --- a/services/brig/src/Brig/Provider/DB.hs +++ b/services/brig/src/Brig/Provider/DB.hs @@ -1,4 +1,3 @@ - module Brig.Provider.DB where import Imports diff --git a/services/brig/src/Brig/Provider/RPC.hs b/services/brig/src/Brig/Provider/RPC.hs index 524fe507e50..5da6f48aece 100644 --- a/services/brig/src/Brig/Provider/RPC.hs +++ b/services/brig/src/Brig/Provider/RPC.hs @@ -1,4 +1,3 @@ - -- | RPCs towards service providers. module Brig.Provider.RPC ( -- * External RPC diff --git a/services/brig/src/Brig/Provider/Template.hs b/services/brig/src/Brig/Provider/Template.hs index 90c682a6ad9..5d0ed6664f6 100644 --- a/services/brig/src/Brig/Provider/Template.hs +++ b/services/brig/src/Brig/Provider/Template.hs @@ -1,4 +1,3 @@ - module Brig.Provider.Template ( ProviderTemplates (..) , ActivationEmailTemplate (..) diff --git a/services/brig/src/Brig/Queue.hs b/services/brig/src/Brig/Queue.hs index e982ae793e2..6c5144bd2fe 100644 --- a/services/brig/src/Brig/Queue.hs +++ b/services/brig/src/Brig/Queue.hs @@ -1,4 +1,3 @@ - -- | Working with remote queues (like Amazon SQS). module Brig.Queue ( module Brig.Queue.Types diff --git a/services/brig/src/Brig/Queue/Stomp.hs b/services/brig/src/Brig/Queue/Stomp.hs index 66045904334..84d5830b950 100644 --- a/services/brig/src/Brig/Queue/Stomp.hs +++ b/services/brig/src/Brig/Queue/Stomp.hs @@ -1,4 +1,3 @@ - -- | Working with STOMP queues (targeting ActiveMQ specifically). module Brig.Queue.Stomp ( Env(..) diff --git a/services/brig/src/Brig/Queue/Types.hs b/services/brig/src/Brig/Queue/Types.hs index bc1ab041721..813d6dd962e 100644 --- a/services/brig/src/Brig/Queue/Types.hs +++ b/services/brig/src/Brig/Queue/Types.hs @@ -1,4 +1,3 @@ - module Brig.Queue.Types ( Queue (..) ) where diff --git a/services/brig/src/Brig/RPC.hs b/services/brig/src/Brig/RPC.hs index f5615e0a665..d63d88c5316 100644 --- a/services/brig/src/Brig/RPC.hs +++ b/services/brig/src/Brig/RPC.hs @@ -1,4 +1,3 @@ - -- | General RPC utilities. module Brig.RPC where diff --git a/services/brig/src/Brig/SMTP.hs b/services/brig/src/Brig/SMTP.hs index 0e3ab1338f6..a7a0712f1b7 100644 --- a/services/brig/src/Brig/SMTP.hs +++ b/services/brig/src/Brig/SMTP.hs @@ -1,4 +1,3 @@ - module Brig.SMTP where import Imports diff --git a/services/brig/src/Brig/TURN.hs b/services/brig/src/Brig/TURN.hs index e2a225c34da..2348275b028 100644 --- a/services/brig/src/Brig/TURN.hs +++ b/services/brig/src/Brig/TURN.hs @@ -1,4 +1,3 @@ - module Brig.TURN where import Imports diff --git a/services/brig/src/Brig/TURN/API.hs b/services/brig/src/Brig/TURN/API.hs index 97a6d6b6c03..d35c8251493 100644 --- a/services/brig/src/Brig/TURN/API.hs +++ b/services/brig/src/Brig/TURN/API.hs @@ -1,4 +1,3 @@ - module Brig.TURN.API (routes) where import Imports hiding (head) diff --git a/services/brig/src/Brig/Team/API.hs b/services/brig/src/Brig/Team/API.hs index cd8ab49594c..56c0240f38d 100644 --- a/services/brig/src/Brig/Team/API.hs +++ b/services/brig/src/Brig/Team/API.hs @@ -1,4 +1,3 @@ - module Brig.Team.API where import Imports diff --git a/services/brig/src/Brig/Team/Template.hs b/services/brig/src/Brig/Team/Template.hs index a81f22ab612..0ef5c736a0b 100644 --- a/services/brig/src/Brig/Team/Template.hs +++ b/services/brig/src/Brig/Team/Template.hs @@ -1,4 +1,3 @@ - module Brig.Team.Template ( TeamTemplates (..) , InvitationEmailTemplate (..) diff --git a/services/brig/src/Brig/Team/Util.hs b/services/brig/src/Brig/Team/Util.hs index 15e3b49a72d..25b198c0c1e 100644 --- a/services/brig/src/Brig/Team/Util.hs +++ b/services/brig/src/Brig/Team/Util.hs @@ -1,4 +1,3 @@ - module Brig.Team.Util where -- TODO: remove this module and move contents to Brig.IO.Intra? import Imports diff --git a/services/brig/src/Brig/Template.hs b/services/brig/src/Brig/Template.hs index 4c302564bc8..884073df528 100644 --- a/services/brig/src/Brig/Template.hs +++ b/services/brig/src/Brig/Template.hs @@ -1,4 +1,3 @@ - -- | Common templating utilities. module Brig.Template ( -- * Reading templates diff --git a/services/brig/src/Brig/Unique.hs b/services/brig/src/Brig/Unique.hs index 51f59260257..222d2ddb827 100644 --- a/services/brig/src/Brig/Unique.hs +++ b/services/brig/src/Brig/Unique.hs @@ -1,4 +1,3 @@ - -- | Temporary exclusive claims on 'Text'ual values which may be subject -- to contention, i.e. where strong guarantees on uniqueness are desired. module Brig.Unique diff --git a/services/brig/src/Brig/User/API/Auth.hs b/services/brig/src/Brig/User/API/Auth.hs index f74463a2504..1c39a20d937 100644 --- a/services/brig/src/Brig/User/API/Auth.hs +++ b/services/brig/src/Brig/User/API/Auth.hs @@ -1,4 +1,3 @@ - module Brig.User.API.Auth (routes) where import Imports diff --git a/services/brig/src/Brig/User/API/Search.hs b/services/brig/src/Brig/User/API/Search.hs index 452042b05ec..420077b1ed6 100644 --- a/services/brig/src/Brig/User/API/Search.hs +++ b/services/brig/src/Brig/User/API/Search.hs @@ -1,4 +1,3 @@ - module Brig.User.API.Search (routes) where import Imports diff --git a/services/brig/src/Brig/User/Auth.hs b/services/brig/src/Brig/User/Auth.hs index 5b639f08e30..9432264106d 100644 --- a/services/brig/src/Brig/User/Auth.hs +++ b/services/brig/src/Brig/User/Auth.hs @@ -1,4 +1,3 @@ - -- | High-level user authentication and access control. module Brig.User.Auth ( Access (..) diff --git a/services/brig/src/Brig/User/Auth/Cookie.hs b/services/brig/src/Brig/User/Auth/Cookie.hs index aef9e457d8a..4d82e66f1c1 100644 --- a/services/brig/src/Brig/User/Auth/Cookie.hs +++ b/services/brig/src/Brig/User/Auth/Cookie.hs @@ -1,4 +1,3 @@ - module Brig.User.Auth.Cookie ( -- * Cookie Essentials newCookie diff --git a/services/brig/src/Brig/User/Auth/Cookie/Limit.hs b/services/brig/src/Brig/User/Auth/Cookie/Limit.hs index 15345f9fcd9..e9d347f215f 100644 --- a/services/brig/src/Brig/User/Auth/Cookie/Limit.hs +++ b/services/brig/src/Brig/User/Auth/Cookie/Limit.hs @@ -1,4 +1,3 @@ - module Brig.User.Auth.Cookie.Limit where import Imports diff --git a/services/brig/src/Brig/User/Event/Log.hs b/services/brig/src/Brig/User/Event/Log.hs index a32971e59dd..54b25beca37 100644 --- a/services/brig/src/Brig/User/Event/Log.hs +++ b/services/brig/src/Brig/User/Event/Log.hs @@ -1,4 +1,3 @@ - {-# OPTIONS_GHC -fno-warn-orphans #-} module Brig.User.Event.Log where diff --git a/services/brig/src/Brig/User/Handle.hs b/services/brig/src/Brig/User/Handle.hs index 7f34df29414..1decb16a01e 100644 --- a/services/brig/src/Brig/User/Handle.hs +++ b/services/brig/src/Brig/User/Handle.hs @@ -1,4 +1,3 @@ - -- | Ownership of unique user handles. module Brig.User.Handle ( claimHandle diff --git a/services/brig/src/Brig/User/Handle/Blacklist.hs b/services/brig/src/Brig/User/Handle/Blacklist.hs index bdf2a8f05b9..91067d2b07c 100644 --- a/services/brig/src/Brig/User/Handle/Blacklist.hs +++ b/services/brig/src/Brig/User/Handle/Blacklist.hs @@ -1,4 +1,3 @@ - module Brig.User.Handle.Blacklist (isBlacklistedHandle) where import Imports diff --git a/services/brig/src/Brig/User/Template.hs b/services/brig/src/Brig/User/Template.hs index 16aa208b3bb..413d21631a1 100644 --- a/services/brig/src/Brig/User/Template.hs +++ b/services/brig/src/Brig/User/Template.hs @@ -1,4 +1,3 @@ - module Brig.User.Template ( UserTemplates (..) , ActivationSmsTemplate (..) diff --git a/services/brig/src/Brig/Whitelist.hs b/services/brig/src/Brig/Whitelist.hs index 89998f96898..337f75040ea 100644 --- a/services/brig/src/Brig/Whitelist.hs +++ b/services/brig/src/Brig/Whitelist.hs @@ -1,4 +1,3 @@ - module Brig.Whitelist (Whitelist (..), verify) where import Imports diff --git a/services/brig/test/integration/API/Search.hs b/services/brig/test/integration/API/Search.hs index f4233aa1188..15db0724fc0 100644 --- a/services/brig/test/integration/API/Search.hs +++ b/services/brig/test/integration/API/Search.hs @@ -1,4 +1,3 @@ - module API.Search (tests) where import Imports diff --git a/services/brig/test/integration/API/Search/Util.hs b/services/brig/test/integration/API/Search/Util.hs index c536ed2903f..055cfe4dfa2 100644 --- a/services/brig/test/integration/API/Search/Util.hs +++ b/services/brig/test/integration/API/Search/Util.hs @@ -1,4 +1,3 @@ - module API.Search.Util where import Imports diff --git a/services/brig/test/integration/API/TURN.hs b/services/brig/test/integration/API/TURN.hs index c5fe79f6799..7b7c1c399da 100644 --- a/services/brig/test/integration/API/TURN.hs +++ b/services/brig/test/integration/API/TURN.hs @@ -1,4 +1,3 @@ - module API.TURN where import Imports diff --git a/services/brig/test/integration/API/Team.hs b/services/brig/test/integration/API/Team.hs index ec353b5ee01..db745587b8a 100644 --- a/services/brig/test/integration/API/Team.hs +++ b/services/brig/test/integration/API/Team.hs @@ -1,4 +1,3 @@ - module API.Team (tests) where import Imports diff --git a/services/brig/test/integration/API/Team/Util.hs b/services/brig/test/integration/API/Team/Util.hs index fd1600c8762..a028f9696d4 100644 --- a/services/brig/test/integration/API/Team/Util.hs +++ b/services/brig/test/integration/API/Team/Util.hs @@ -1,4 +1,3 @@ - module API.Team.Util where import Imports diff --git a/services/brig/test/integration/API/User.hs b/services/brig/test/integration/API/User.hs index 5819b58b158..16ac865ccf6 100644 --- a/services/brig/test/integration/API/User.hs +++ b/services/brig/test/integration/API/User.hs @@ -1,4 +1,3 @@ - module API.User (tests, ConnectionLimit (..)) where import Imports diff --git a/services/brig/test/integration/API/User/Account.hs b/services/brig/test/integration/API/User/Account.hs index ed1f092fe07..2421d8b6de5 100644 --- a/services/brig/test/integration/API/User/Account.hs +++ b/services/brig/test/integration/API/User/Account.hs @@ -1,4 +1,3 @@ - module API.User.Account (tests) where import Imports diff --git a/services/brig/test/integration/API/User/Auth.hs b/services/brig/test/integration/API/User/Auth.hs index 20f8602d7af..525830692a8 100644 --- a/services/brig/test/integration/API/User/Auth.hs +++ b/services/brig/test/integration/API/User/Auth.hs @@ -1,4 +1,3 @@ - module API.User.Auth (tests) where import Imports diff --git a/services/brig/test/integration/API/User/Client.hs b/services/brig/test/integration/API/User/Client.hs index 4d8c44d6216..644e707b843 100644 --- a/services/brig/test/integration/API/User/Client.hs +++ b/services/brig/test/integration/API/User/Client.hs @@ -1,4 +1,3 @@ - module API.User.Client (tests) where import Imports diff --git a/services/brig/test/integration/API/User/Connection.hs b/services/brig/test/integration/API/User/Connection.hs index 2f050c28d04..0ba94beb451 100644 --- a/services/brig/test/integration/API/User/Connection.hs +++ b/services/brig/test/integration/API/User/Connection.hs @@ -1,4 +1,3 @@ - module API.User.Connection (tests) where import Imports diff --git a/services/brig/test/integration/API/User/Handles.hs b/services/brig/test/integration/API/User/Handles.hs index 63c0e5aac8a..ba2e04ff208 100644 --- a/services/brig/test/integration/API/User/Handles.hs +++ b/services/brig/test/integration/API/User/Handles.hs @@ -1,4 +1,3 @@ - module API.User.Handles (tests) where import Imports diff --git a/services/brig/test/integration/API/User/Onboarding.hs b/services/brig/test/integration/API/User/Onboarding.hs index fa70d0f5110..14110b9e705 100644 --- a/services/brig/test/integration/API/User/Onboarding.hs +++ b/services/brig/test/integration/API/User/Onboarding.hs @@ -1,4 +1,3 @@ - module API.User.Onboarding (tests) where import Imports diff --git a/services/brig/test/integration/API/User/PasswordReset.hs b/services/brig/test/integration/API/User/PasswordReset.hs index 6ae2ed278d2..b14faa3a1b0 100644 --- a/services/brig/test/integration/API/User/PasswordReset.hs +++ b/services/brig/test/integration/API/User/PasswordReset.hs @@ -1,4 +1,3 @@ - module API.User.PasswordReset (tests) where import Imports diff --git a/services/brig/test/integration/API/User/Property.hs b/services/brig/test/integration/API/User/Property.hs index bcb5532b1e9..7124e953b63 100644 --- a/services/brig/test/integration/API/User/Property.hs +++ b/services/brig/test/integration/API/User/Property.hs @@ -1,4 +1,3 @@ - module API.User.Property (tests) where import Imports diff --git a/services/brig/test/integration/API/User/Util.hs b/services/brig/test/integration/API/User/Util.hs index 835d3455525..2c708f702c5 100644 --- a/services/brig/test/integration/API/User/Util.hs +++ b/services/brig/test/integration/API/User/Util.hs @@ -1,4 +1,3 @@ - module API.User.Util where import Imports diff --git a/services/brig/test/integration/Main.hs b/services/brig/test/integration/Main.hs index abd10ed7707..04529a7e134 100644 --- a/services/brig/test/integration/Main.hs +++ b/services/brig/test/integration/Main.hs @@ -1,4 +1,3 @@ - module Main (main) where import Imports hiding (local) diff --git a/services/brig/test/integration/Util/AWS.hs b/services/brig/test/integration/Util/AWS.hs index 4d0a59525ea..522c01471b9 100644 --- a/services/brig/test/integration/Util/AWS.hs +++ b/services/brig/test/integration/Util/AWS.hs @@ -1,4 +1,3 @@ - module Util.AWS where import Imports diff --git a/services/cannon/src/Cannon/API.hs b/services/cannon/src/Cannon/API.hs index 0bd0046ed2e..0eacb0954ee 100644 --- a/services/cannon/src/Cannon/API.hs +++ b/services/cannon/src/Cannon/API.hs @@ -1,4 +1,3 @@ - module Cannon.API (run) where import Imports hiding (head) diff --git a/services/cannon/src/Cannon/App.hs b/services/cannon/src/Cannon/App.hs index 07c6a4516f1..987167c704c 100644 --- a/services/cannon/src/Cannon/App.hs +++ b/services/cannon/src/Cannon/App.hs @@ -1,4 +1,3 @@ - module Cannon.App (wsapp, terminate, maxPingInterval) where import Imports hiding (threadDelay) diff --git a/services/cannon/src/Cannon/Dict.hs b/services/cannon/src/Cannon/Dict.hs index aafc84f3a58..91d2e5c2afb 100644 --- a/services/cannon/src/Cannon/Dict.hs +++ b/services/cannon/src/Cannon/Dict.hs @@ -1,4 +1,3 @@ - module Cannon.Dict ( Dict , empty diff --git a/services/cannon/test/Bench.hs b/services/cannon/test/Bench.hs index 9165b36ae7b..e37f10d2d0e 100644 --- a/services/cannon/test/Bench.hs +++ b/services/cannon/test/Bench.hs @@ -1,4 +1,3 @@ - module Bench (Bench.benchmark) where import Imports diff --git a/services/cannon/test/Test/Cannon/Dict.hs b/services/cannon/test/Test/Cannon/Dict.hs index 99a4d39c0ef..25c3f04e282 100644 --- a/services/cannon/test/Test/Cannon/Dict.hs +++ b/services/cannon/test/Test/Cannon/Dict.hs @@ -1,4 +1,3 @@ - {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.Cannon.Dict where diff --git a/services/cargohold/src/CargoHold/API.hs b/services/cargohold/src/CargoHold/API.hs index de77f23c457..bbc6042b559 100644 --- a/services/cargohold/src/CargoHold/API.hs +++ b/services/cargohold/src/CargoHold/API.hs @@ -1,4 +1,3 @@ - module CargoHold.API (runServer, parseOptions) where import Imports hiding (head) diff --git a/services/cargohold/src/CargoHold/API/Error.hs b/services/cargohold/src/CargoHold/API/Error.hs index 4d7116f3122..fefb18aac8d 100644 --- a/services/cargohold/src/CargoHold/API/Error.hs +++ b/services/cargohold/src/CargoHold/API/Error.hs @@ -1,4 +1,3 @@ - module CargoHold.API.Error where import Imports diff --git a/services/cargohold/src/CargoHold/API/Legacy.hs b/services/cargohold/src/CargoHold/API/Legacy.hs index 201476349b5..380f99093fe 100644 --- a/services/cargohold/src/CargoHold/API/Legacy.hs +++ b/services/cargohold/src/CargoHold/API/Legacy.hs @@ -1,4 +1,3 @@ - -- Legacy: module CargoHold.API.Legacy ( download diff --git a/services/cargohold/src/CargoHold/API/V3.hs b/services/cargohold/src/CargoHold/API/V3.hs index bc0b8728ba2..4d5e2f34433 100644 --- a/services/cargohold/src/CargoHold/API/V3.hs +++ b/services/cargohold/src/CargoHold/API/V3.hs @@ -1,4 +1,3 @@ - module CargoHold.API.V3 ( upload , download diff --git a/services/cargohold/src/CargoHold/API/V3/Resumable.hs b/services/cargohold/src/CargoHold/API/V3/Resumable.hs index 4600033c4f0..89738492212 100644 --- a/services/cargohold/src/CargoHold/API/V3/Resumable.hs +++ b/services/cargohold/src/CargoHold/API/V3/Resumable.hs @@ -1,4 +1,3 @@ - module CargoHold.API.V3.Resumable ( create , status diff --git a/services/cargohold/src/CargoHold/Metrics.hs b/services/cargohold/src/CargoHold/Metrics.hs index c99ed7f0f94..567de93f39f 100644 --- a/services/cargohold/src/CargoHold/Metrics.hs +++ b/services/cargohold/src/CargoHold/Metrics.hs @@ -1,4 +1,3 @@ - module CargoHold.Metrics where import Imports diff --git a/services/cargohold/src/CargoHold/TUS.hs b/services/cargohold/src/CargoHold/TUS.hs index 0ee4c85420e..dd6f99d4fc4 100644 --- a/services/cargohold/src/CargoHold/TUS.hs +++ b/services/cargohold/src/CargoHold/TUS.hs @@ -1,4 +1,3 @@ - module CargoHold.TUS ( createdResponse , headResponse diff --git a/services/cargohold/src/CargoHold/Util.hs b/services/cargohold/src/CargoHold/Util.hs index 7172e2990b5..33ac875165f 100644 --- a/services/cargohold/src/CargoHold/Util.hs +++ b/services/cargohold/src/CargoHold/Util.hs @@ -1,4 +1,3 @@ - module CargoHold.Util where import Imports diff --git a/services/cargohold/test/integration/API/V3.hs b/services/cargohold/test/integration/API/V3.hs index f35a982061c..577b8bcc7a0 100644 --- a/services/cargohold/test/integration/API/V3.hs +++ b/services/cargohold/test/integration/API/V3.hs @@ -1,4 +1,3 @@ - module API.V3 where import Imports hiding (head) diff --git a/services/cargohold/test/integration/Main.hs b/services/cargohold/test/integration/Main.hs index 515e51fdce8..109591da856 100644 --- a/services/cargohold/test/integration/Main.hs +++ b/services/cargohold/test/integration/Main.hs @@ -1,4 +1,3 @@ - module Main (main) where import Imports hiding (local) diff --git a/services/galley/journaler/src/Journal.hs b/services/galley/journaler/src/Journal.hs index d51434f6771..cc498f2acb4 100644 --- a/services/galley/journaler/src/Journal.hs +++ b/services/galley/journaler/src/Journal.hs @@ -1,4 +1,3 @@ - module Journal where import Imports diff --git a/services/galley/journaler/src/Main.hs b/services/galley/journaler/src/Main.hs index bbe184460bd..20442d8fc4b 100644 --- a/services/galley/journaler/src/Main.hs +++ b/services/galley/journaler/src/Main.hs @@ -1,4 +1,3 @@ - module Main (main) where import Imports diff --git a/services/galley/journaler/src/Options.hs b/services/galley/journaler/src/Options.hs index f2869a429ff..5157a37905a 100644 --- a/services/galley/journaler/src/Options.hs +++ b/services/galley/journaler/src/Options.hs @@ -1,4 +1,3 @@ - module Options ( Settings (..) diff --git a/services/galley/schema/src/Main.hs b/services/galley/schema/src/Main.hs index 06d52a6c8f7..89f9c3017db 100644 --- a/services/galley/schema/src/Main.hs +++ b/services/galley/schema/src/Main.hs @@ -1,4 +1,3 @@ - module Main where import Imports diff --git a/services/galley/schema/src/V20.hs b/services/galley/schema/src/V20.hs index ae9abb011f6..053fb569761 100644 --- a/services/galley/schema/src/V20.hs +++ b/services/galley/schema/src/V20.hs @@ -1,4 +1,3 @@ - module V20 (migration) where import Imports diff --git a/services/galley/schema/src/V21.hs b/services/galley/schema/src/V21.hs index 633242b91ff..89899405211 100644 --- a/services/galley/schema/src/V21.hs +++ b/services/galley/schema/src/V21.hs @@ -1,4 +1,3 @@ - module V21 (migration) where import Imports diff --git a/services/galley/schema/src/V22.hs b/services/galley/schema/src/V22.hs index 44c2b9c15bf..73d63cfd93f 100644 --- a/services/galley/schema/src/V22.hs +++ b/services/galley/schema/src/V22.hs @@ -1,4 +1,3 @@ - module V22 (migration) where import Imports diff --git a/services/galley/schema/src/V23.hs b/services/galley/schema/src/V23.hs index 3f60dcd8a4c..772de14bf4c 100644 --- a/services/galley/schema/src/V23.hs +++ b/services/galley/schema/src/V23.hs @@ -1,4 +1,3 @@ - module V23 (migration) where import Imports diff --git a/services/galley/schema/src/V24.hs b/services/galley/schema/src/V24.hs index bafbbdecb95..51b049f0f29 100644 --- a/services/galley/schema/src/V24.hs +++ b/services/galley/schema/src/V24.hs @@ -1,4 +1,3 @@ - module V24 (migration) where import Imports diff --git a/services/galley/schema/src/V25.hs b/services/galley/schema/src/V25.hs index 83fa855ee89..00eb672d303 100644 --- a/services/galley/schema/src/V25.hs +++ b/services/galley/schema/src/V25.hs @@ -1,4 +1,3 @@ - module V25 (migration) where import Imports diff --git a/services/galley/schema/src/V26.hs b/services/galley/schema/src/V26.hs index af0d8dbea0e..7236ffaf50d 100644 --- a/services/galley/schema/src/V26.hs +++ b/services/galley/schema/src/V26.hs @@ -1,4 +1,3 @@ - module V26 (migration) where import Imports diff --git a/services/galley/schema/src/V27.hs b/services/galley/schema/src/V27.hs index ff4dd557ba5..b3154149af6 100644 --- a/services/galley/schema/src/V27.hs +++ b/services/galley/schema/src/V27.hs @@ -1,4 +1,3 @@ - module V27 (migration) where import Imports diff --git a/services/galley/schema/src/V28.hs b/services/galley/schema/src/V28.hs index cc1e68fe146..2f8bd9113bb 100644 --- a/services/galley/schema/src/V28.hs +++ b/services/galley/schema/src/V28.hs @@ -1,4 +1,3 @@ - module V28 (migration) where import Imports diff --git a/services/galley/schema/src/V29.hs b/services/galley/schema/src/V29.hs index f61a8df0642..5cd72d1e86c 100644 --- a/services/galley/schema/src/V29.hs +++ b/services/galley/schema/src/V29.hs @@ -1,4 +1,3 @@ - module V29 (migration) where import Imports diff --git a/services/galley/schema/src/V30.hs b/services/galley/schema/src/V30.hs index dd2fbb768e3..861ae247f74 100644 --- a/services/galley/schema/src/V30.hs +++ b/services/galley/schema/src/V30.hs @@ -1,4 +1,3 @@ - module V30 (migration) where import Imports diff --git a/services/galley/src/Galley/API.hs b/services/galley/src/Galley/API.hs index 19133493dc2..ce6d653d5f5 100644 --- a/services/galley/src/Galley/API.hs +++ b/services/galley/src/Galley/API.hs @@ -1,4 +1,3 @@ - module Galley.API where import Imports hiding (head) diff --git a/services/galley/src/Galley/API/Clients.hs b/services/galley/src/Galley/API/Clients.hs index c575b3995cc..03bee7d94b5 100644 --- a/services/galley/src/Galley/API/Clients.hs +++ b/services/galley/src/Galley/API/Clients.hs @@ -1,4 +1,3 @@ - module Galley.API.Clients ( getClients , addClient diff --git a/services/galley/src/Galley/API/Create.hs b/services/galley/src/Galley/API/Create.hs index 411043a3679..918b60950fc 100644 --- a/services/galley/src/Galley/API/Create.hs +++ b/services/galley/src/Galley/API/Create.hs @@ -1,4 +1,3 @@ - module Galley.API.Create ( createGroupConversation , internalCreateManagedConversation diff --git a/services/galley/src/Galley/API/Error.hs b/services/galley/src/Galley/API/Error.hs index 425e677b822..2fc34afbe05 100644 --- a/services/galley/src/Galley/API/Error.hs +++ b/services/galley/src/Galley/API/Error.hs @@ -1,4 +1,3 @@ - module Galley.API.Error where import Imports diff --git a/services/galley/src/Galley/API/Internal.hs b/services/galley/src/Galley/API/Internal.hs index 2fbdd155b98..e104a74a222 100644 --- a/services/galley/src/Galley/API/Internal.hs +++ b/services/galley/src/Galley/API/Internal.hs @@ -1,4 +1,3 @@ - module Galley.API.Internal ( rmUser , deleteLoop diff --git a/services/galley/src/Galley/API/Query.hs b/services/galley/src/Galley/API/Query.hs index 0d984484a83..4c375d67eaa 100644 --- a/services/galley/src/Galley/API/Query.hs +++ b/services/galley/src/Galley/API/Query.hs @@ -1,4 +1,3 @@ - module Galley.API.Query where import Imports diff --git a/services/galley/src/Galley/API/Teams.hs b/services/galley/src/Galley/API/Teams.hs index 7f62c0d48ea..338c9922ac3 100644 --- a/services/galley/src/Galley/API/Teams.hs +++ b/services/galley/src/Galley/API/Teams.hs @@ -1,4 +1,3 @@ - module Galley.API.Teams ( createBindingTeam , createNonBindingTeam diff --git a/services/galley/src/Galley/API/Update.hs b/services/galley/src/Galley/API/Update.hs index 2c513bb64e5..6f1dd845b0b 100644 --- a/services/galley/src/Galley/API/Update.hs +++ b/services/galley/src/Galley/API/Update.hs @@ -1,4 +1,3 @@ - module Galley.API.Update ( -- * Managing Conversations updateConversation diff --git a/services/galley/src/Galley/API/Util.hs b/services/galley/src/Galley/API/Util.hs index 7507fa6fb38..34092119c0f 100644 --- a/services/galley/src/Galley/API/Util.hs +++ b/services/galley/src/Galley/API/Util.hs @@ -1,4 +1,3 @@ - module Galley.API.Util where import Imports diff --git a/services/galley/src/Galley/Data/Queries.hs b/services/galley/src/Galley/Data/Queries.hs index 82109be581b..0000990a500 100644 --- a/services/galley/src/Galley/Data/Queries.hs +++ b/services/galley/src/Galley/Data/Queries.hs @@ -1,4 +1,3 @@ - module Galley.Data.Queries where import Imports diff --git a/services/galley/src/Galley/Data/Services.hs b/services/galley/src/Galley/Data/Services.hs index 16756ac969b..7ea2f205dbc 100644 --- a/services/galley/src/Galley/Data/Services.hs +++ b/services/galley/src/Galley/Data/Services.hs @@ -1,4 +1,3 @@ - module Galley.Data.Services ( -- * BotMember BotMember diff --git a/services/galley/src/Galley/External.hs b/services/galley/src/Galley/External.hs index 0e182849eb0..82052a033fb 100644 --- a/services/galley/src/Galley/External.hs +++ b/services/galley/src/Galley/External.hs @@ -1,4 +1,3 @@ - module Galley.External (deliver) where import Imports diff --git a/services/galley/src/Galley/Intra/Client.hs b/services/galley/src/Galley/Intra/Client.hs index 2e5a2af1592..b1c01b752ab 100644 --- a/services/galley/src/Galley/Intra/Client.hs +++ b/services/galley/src/Galley/Intra/Client.hs @@ -1,4 +1,3 @@ - module Galley.Intra.Client ( lookupClients ) where diff --git a/services/galley/src/Galley/Intra/Journal.hs b/services/galley/src/Galley/Intra/Journal.hs index 5bafd43ab3e..557094af31f 100644 --- a/services/galley/src/Galley/Intra/Journal.hs +++ b/services/galley/src/Galley/Intra/Journal.hs @@ -1,4 +1,3 @@ - module Galley.Intra.Journal ( teamActivate , teamUpdate diff --git a/services/galley/src/Galley/Intra/Spar.hs b/services/galley/src/Galley/Intra/Spar.hs index 3739e0d9af4..89a6500e189 100644 --- a/services/galley/src/Galley/Intra/Spar.hs +++ b/services/galley/src/Galley/Intra/Spar.hs @@ -1,4 +1,3 @@ - module Galley.Intra.Spar ( deleteTeam ) where diff --git a/services/galley/src/Galley/Intra/User.hs b/services/galley/src/Galley/Intra/User.hs index 457d350fcc9..5011033c085 100644 --- a/services/galley/src/Galley/Intra/User.hs +++ b/services/galley/src/Galley/Intra/User.hs @@ -1,4 +1,3 @@ - module Galley.Intra.User ( getConnections , deleteBot diff --git a/services/galley/src/Galley/Intra/Util.hs b/services/galley/src/Galley/Intra/Util.hs index 857ac623f00..a3c8e2d8922 100644 --- a/services/galley/src/Galley/Intra/Util.hs +++ b/services/galley/src/Galley/Intra/Util.hs @@ -1,4 +1,3 @@ - module Galley.Intra.Util ( brigReq , sparReq diff --git a/services/galley/src/Galley/Options.hs b/services/galley/src/Galley/Options.hs index 24599aeb7c3..37673caece6 100644 --- a/services/galley/src/Galley/Options.hs +++ b/services/galley/src/Galley/Options.hs @@ -1,4 +1,3 @@ - module Galley.Options where import Imports diff --git a/services/galley/src/Galley/Validation.hs b/services/galley/src/Galley/Validation.hs index 5c6244d3dfe..47eba7a28fc 100644 --- a/services/galley/src/Galley/Validation.hs +++ b/services/galley/src/Galley/Validation.hs @@ -1,4 +1,3 @@ - module Galley.Validation ( rangeChecked , rangeCheckedMaybe diff --git a/services/galley/test/integration/API.hs b/services/galley/test/integration/API.hs index 1c43603dc4d..8f24b232b19 100644 --- a/services/galley/test/integration/API.hs +++ b/services/galley/test/integration/API.hs @@ -1,4 +1,3 @@ - module API (tests) where import Imports diff --git a/services/galley/test/integration/API/MessageTimer.hs b/services/galley/test/integration/API/MessageTimer.hs index 61128be7e64..5f05907e6a0 100644 --- a/services/galley/test/integration/API/MessageTimer.hs +++ b/services/galley/test/integration/API/MessageTimer.hs @@ -1,4 +1,3 @@ - module API.MessageTimer (tests) where import Imports hiding (head) diff --git a/services/galley/test/integration/API/SQS.hs b/services/galley/test/integration/API/SQS.hs index 907f00be77c..1ece9ba02f5 100644 --- a/services/galley/test/integration/API/SQS.hs +++ b/services/galley/test/integration/API/SQS.hs @@ -1,4 +1,3 @@ - -- | TODO: most of this module is deprecated; use "Util.Test.SQS" from the types-common-aws package -- instead. module API.SQS where diff --git a/services/galley/test/integration/API/Teams.hs b/services/galley/test/integration/API/Teams.hs index 3b0f0f8096c..afb9c37c479 100644 --- a/services/galley/test/integration/API/Teams.hs +++ b/services/galley/test/integration/API/Teams.hs @@ -1,4 +1,3 @@ - module API.Teams (tests) where import Imports diff --git a/services/galley/test/integration/API/Util.hs b/services/galley/test/integration/API/Util.hs index 2bdce576b8d..64869909754 100644 --- a/services/galley/test/integration/API/Util.hs +++ b/services/galley/test/integration/API/Util.hs @@ -1,4 +1,3 @@ - module API.Util where import Imports diff --git a/services/galley/test/integration/Main.hs b/services/galley/test/integration/Main.hs index 693d2cadf4c..6ec7db0c305 100644 --- a/services/galley/test/integration/Main.hs +++ b/services/galley/test/integration/Main.hs @@ -1,4 +1,3 @@ - module Main (main) where import Imports hiding (local) diff --git a/services/gundeck/schema/src/Main.hs b/services/gundeck/schema/src/Main.hs index 11dc495bbe5..ae1dd4ea973 100644 --- a/services/gundeck/schema/src/Main.hs +++ b/services/gundeck/schema/src/Main.hs @@ -1,4 +1,3 @@ - module Main where import Imports diff --git a/services/gundeck/schema/src/V1.hs b/services/gundeck/schema/src/V1.hs index 76942969aa9..05588caffae 100644 --- a/services/gundeck/schema/src/V1.hs +++ b/services/gundeck/schema/src/V1.hs @@ -1,4 +1,3 @@ - module V1 (migration) where import Imports diff --git a/services/gundeck/schema/src/V2.hs b/services/gundeck/schema/src/V2.hs index f9bbd9cc8f2..e6763444d34 100644 --- a/services/gundeck/schema/src/V2.hs +++ b/services/gundeck/schema/src/V2.hs @@ -1,4 +1,3 @@ - module V2 (migration) where import Imports diff --git a/services/gundeck/schema/src/V3.hs b/services/gundeck/schema/src/V3.hs index 62a5d488db8..6d239c65fce 100644 --- a/services/gundeck/schema/src/V3.hs +++ b/services/gundeck/schema/src/V3.hs @@ -1,4 +1,3 @@ - module V3 (migration) where import Imports diff --git a/services/gundeck/schema/src/V4.hs b/services/gundeck/schema/src/V4.hs index fc3a19405b2..1773021317f 100644 --- a/services/gundeck/schema/src/V4.hs +++ b/services/gundeck/schema/src/V4.hs @@ -1,4 +1,3 @@ - module V4 (migration) where import Imports diff --git a/services/gundeck/schema/src/V5.hs b/services/gundeck/schema/src/V5.hs index de945ba2de4..25a30931960 100644 --- a/services/gundeck/schema/src/V5.hs +++ b/services/gundeck/schema/src/V5.hs @@ -1,4 +1,3 @@ - module V5 (migration) where import Imports diff --git a/services/gundeck/schema/src/V6.hs b/services/gundeck/schema/src/V6.hs index e283160f969..dd5fa8220d3 100644 --- a/services/gundeck/schema/src/V6.hs +++ b/services/gundeck/schema/src/V6.hs @@ -1,4 +1,3 @@ - module V6 (migration) where import Imports diff --git a/services/gundeck/schema/src/V7.hs b/services/gundeck/schema/src/V7.hs index 59af6d88379..659ba4a8d7d 100644 --- a/services/gundeck/schema/src/V7.hs +++ b/services/gundeck/schema/src/V7.hs @@ -1,4 +1,3 @@ - module V7 (migration) where import Imports diff --git a/services/gundeck/src/Gundeck/API.hs b/services/gundeck/src/Gundeck/API.hs index 7985f2b8835..9a8540f6bda 100644 --- a/services/gundeck/src/Gundeck/API.hs +++ b/services/gundeck/src/Gundeck/API.hs @@ -1,4 +1,3 @@ - module Gundeck.API where import Imports hiding (head) diff --git a/services/gundeck/src/Gundeck/API/Error.hs b/services/gundeck/src/Gundeck/API/Error.hs index 4a0380361c0..85ec7564297 100644 --- a/services/gundeck/src/Gundeck/API/Error.hs +++ b/services/gundeck/src/Gundeck/API/Error.hs @@ -1,4 +1,3 @@ - module Gundeck.API.Error where import Data.Text.Lazy (Text) diff --git a/services/gundeck/src/Gundeck/Aws/Sns.hs b/services/gundeck/src/Gundeck/Aws/Sns.hs index 2e384a784c5..6e7e3f88940 100644 --- a/services/gundeck/src/Gundeck/Aws/Sns.hs +++ b/services/gundeck/src/Gundeck/Aws/Sns.hs @@ -1,4 +1,3 @@ - module Gundeck.Aws.Sns ( Event , EventType (..) diff --git a/services/gundeck/src/Gundeck/Client.hs b/services/gundeck/src/Gundeck/Client.hs index c06eb301793..cd110218c28 100644 --- a/services/gundeck/src/Gundeck/Client.hs +++ b/services/gundeck/src/Gundeck/Client.hs @@ -1,4 +1,3 @@ - module Gundeck.Client ( register , unregister diff --git a/services/gundeck/src/Gundeck/Env.hs b/services/gundeck/src/Gundeck/Env.hs index e76dcca20c8..c9a30ec3d44 100644 --- a/services/gundeck/src/Gundeck/Env.hs +++ b/services/gundeck/src/Gundeck/Env.hs @@ -1,4 +1,3 @@ - module Gundeck.Env where import Imports diff --git a/services/gundeck/src/Gundeck/Notification.hs b/services/gundeck/src/Gundeck/Notification.hs index 21791681725..3174cba9c3b 100644 --- a/services/gundeck/src/Gundeck/Notification.hs +++ b/services/gundeck/src/Gundeck/Notification.hs @@ -1,4 +1,3 @@ - module Gundeck.Notification ( paginate , getById diff --git a/services/gundeck/src/Gundeck/Notification/Data.hs b/services/gundeck/src/Gundeck/Notification/Data.hs index ffb447585b0..9d6b655b1d1 100644 --- a/services/gundeck/src/Gundeck/Notification/Data.hs +++ b/services/gundeck/src/Gundeck/Notification/Data.hs @@ -1,4 +1,3 @@ - module Gundeck.Notification.Data ( ResultPage (..) , add diff --git a/services/gundeck/src/Gundeck/Presence.hs b/services/gundeck/src/Gundeck/Presence.hs index 4cc50e80113..caed5aa686e 100644 --- a/services/gundeck/src/Gundeck/Presence.hs +++ b/services/gundeck/src/Gundeck/Presence.hs @@ -1,4 +1,3 @@ - module Gundeck.Presence ( list , listAll diff --git a/services/gundeck/src/Gundeck/Presence/Data.hs b/services/gundeck/src/Gundeck/Presence/Data.hs index 99f4c5bf306..c0e688eb396 100644 --- a/services/gundeck/src/Gundeck/Presence/Data.hs +++ b/services/gundeck/src/Gundeck/Presence/Data.hs @@ -1,4 +1,3 @@ - module Gundeck.Presence.Data ( add , list diff --git a/services/gundeck/src/Gundeck/Push.hs b/services/gundeck/src/Gundeck/Push.hs index b281b4a326b..17c21dd4df2 100644 --- a/services/gundeck/src/Gundeck/Push.hs +++ b/services/gundeck/src/Gundeck/Push.hs @@ -1,4 +1,3 @@ - module Gundeck.Push ( push , addToken @@ -73,7 +72,7 @@ class MonadThrow m => MonadPushAll m where mpaListAllPresences :: [UserId] -> m [[Presence]] mpaBulkPush :: [(Notification, [Presence])] -> m [(NotificationId, [Presence])] mpaStreamAdd :: NotificationId -> List1 NotificationTarget -> List1 Aeson.Object -> NotificationTTL -> m () - mpaPushNative :: Notification -> Push -> [Address "no-keys"] -> m () + mpaPushNative :: Notification -> Push -> [Address] -> m () mpaForkIO :: m () -> m () instance MonadPushAll Gundeck where @@ -87,13 +86,13 @@ instance MonadPushAll Gundeck where -- | Abstract over all effects in 'nativeTargets' (for unit testing). class Monad m => MonadNativeTargets m where - mntgtLogErr :: SomeException -> m () - mntgtLookupAddress :: UserId -> m [Address "no-keys"] -- ^ REFACTOR: rename to 'mntgtLookupAddresses'! - mntgtMapAsync :: (a -> m b) -> [a] -> m [Either SomeException b] + mntgtLogErr :: SomeException -> m () + mntgtLookupAddresses :: UserId -> m [Address] + mntgtMapAsync :: (a -> m b) -> [a] -> m [Either SomeException b] instance MonadNativeTargets Gundeck where mntgtLogErr e = Log.err (msg (val "Failed to get native push address: " +++ show e)) - mntgtLookupAddress rcp = Data.lookup rcp Data.One + mntgtLookupAddresses rcp = Data.lookup rcp Data.One mntgtMapAsync = mapAsync -- | Abstract over all effects in 'pushAny' (for unit testing). @@ -243,13 +242,13 @@ shouldActuallyPush psh rcp pres = not isOrigin && okByPushWhitelist && okByRecip -- | Failures to push natively can be ignored. Logging already happens in -- 'Gundeck.Push.Native.push1', and we cannot recover from any of the error cases. -pushNative :: Notification -> Push -> [Address "no-keys"] -> Gundeck () +pushNative :: Notification -> Push -> [Address] -> Gundeck () pushNative _ _ [] = return () pushNative notif p rcps = do let prio = p^.pushNativePriority - void $ Native.push (Native.Notice (ntfId notif) prio Nothing) rcps + void $ Native.push (Native.NativePush (ntfId notif) prio Nothing) rcps -nativeTargets :: forall m. MonadNativeTargets m => Push -> [Presence] -> m [Address "no-keys"] +nativeTargets :: forall m. MonadNativeTargets m => Push -> [Presence] -> m [Address] nativeTargets p pres = let rcps' = filter routeNative (toList (fromRange (p^.pushRecipients))) in mntgtMapAsync addresses rcps' >>= fmap concat . mapM check @@ -258,9 +257,9 @@ nativeTargets p pres = routeNative u = u^.recipientRoute /= RouteDirect && (u^.recipientId /= p^.pushOrigin || p^.pushNativeIncludeOrigin) - addresses :: Recipient -> m [Address "no-keys"] + addresses :: Recipient -> m [Address] addresses u = do - addrs <- mntgtLookupAddress (u^.recipientId) + addrs <- mntgtLookupAddresses (u^.recipientId) return $ preference . filter (eligible u) $ addrs @@ -335,7 +334,7 @@ addToken (uid ::: cid ::: req ::: _) = do continue t Nothing = create (0 :: Int) t continue t (Just a) = update (0 :: Int) t (a^.addrEndpoint) - create :: Int -> PushToken -> Gundeck (Either Response (Address "no-keys")) + create :: Int -> PushToken -> Gundeck (Either Response Address) create n t = do let trp = t^.tokenTransport let app = t^.tokenApp @@ -361,7 +360,7 @@ addToken (uid ::: cid ::: req ::: _) = do Data.insert uid trp app tok arn cid (t^.tokenClient) return (Right (mkAddr t arn)) - update :: Int -> PushToken -> SnsArn EndpointTopic -> Gundeck (Either Response (Address "no-keys")) + update :: Int -> PushToken -> SnsArn EndpointTopic -> Gundeck (Either Response Address) update n t arn = do when (n >= 3) $ do Log.err $ msg (val "AWS SNS inconsistency w.r.t. " +++ toText arn) @@ -386,8 +385,8 @@ addToken (uid ::: cid ::: req ::: _) = do Aws.InvalidCustomData {} -> return (Left metadataTooLong) ex -> throwM ex - mkAddr t arn = Address uid (t^.tokenTransport) (t^.tokenApp) (t^.token) - arn cid (t^.tokenClient) + mkAddr t arn = Address uid arn cid + (pushToken (t^.tokenTransport) (t^.tokenApp) (t^.token) (t^.tokenClient)) -- | Update an SNS endpoint with the given user and token. updateEndpoint :: UserId -> PushToken -> EndpointArn -> Aws.SNSEndpoint -> Gundeck () @@ -439,7 +438,4 @@ notFound = empty & setStatus status404 listTokens :: UserId ::: JSON -> Gundeck Response listTokens (uid ::: _) = - setStatus status200 . json . PushTokenList . map toToken <$> Data.lookup uid Data.Quorum - where - toToken :: Address s -> PushToken - toToken a = pushToken (a^.addrTransport) (a^.addrApp) (a^.addrToken) (a^.addrClient) + setStatus status200 . json . PushTokenList . map (^.addrPushToken) <$> Data.lookup uid Data.Quorum diff --git a/services/gundeck/src/Gundeck/Push/Data.hs b/services/gundeck/src/Gundeck/Push/Data.hs index ed28507e3b2..7b812ad594f 100644 --- a/services/gundeck/src/Gundeck/Push/Data.hs +++ b/services/gundeck/src/Gundeck/Push/Data.hs @@ -1,4 +1,3 @@ - module Gundeck.Push.Data ( insert , delete @@ -18,7 +17,7 @@ import System.Logger.Class (MonadLogger, val, msg, field, (~~)) import qualified System.Logger.Class as Log -lookup :: (MonadClient m, MonadLogger m) => UserId -> Consistency -> m [Address "no-keys"] +lookup :: (MonadClient m, MonadLogger m) => UserId -> Consistency -> m [Address] lookup u c = foldM mk [] =<< retry x1 (query q (params c (Identity u))) where q :: PrepQuery R (Identity UserId) (UserId, Transport, AppName, Token, Maybe EndpointArn, ConnId, Maybe ClientId) @@ -46,9 +45,9 @@ erase u = retry x5 $ write q (params Quorum (Identity u)) mkAddr :: (MonadClient m, MonadLogger m) => (UserId, Transport, AppName, Token, Maybe EndpointArn, ConnId, Maybe ClientId) - -> m (Maybe (Address "no-keys")) + -> m (Maybe Address) mkAddr (usr, trp, app, tok, arn, con, clt) = case (clt, arn) of - (Just c, Just a) -> return $! Just $! Address usr trp app tok a con c + (Just c, Just a) -> return $! Just $! Address usr a con (pushToken trp app tok c) _ -> do Log.info $ field "user" (toByteString usr) ~~ field "transport" (show trp) diff --git a/services/gundeck/src/Gundeck/Push/Native.hs b/services/gundeck/src/Gundeck/Push/Native.hs index e1c4282227c..d25dcb2d056 100644 --- a/services/gundeck/src/Gundeck/Push/Native.hs +++ b/services/gundeck/src/Gundeck/Push/Native.hs @@ -1,4 +1,3 @@ - module Gundeck.Push.Native ( push , deleteTokens @@ -31,12 +30,12 @@ import qualified Gundeck.Notification.Data as Stream import qualified Gundeck.Push.Data as Data import qualified System.Logger.Class as Log -push :: Message s -> [Address s] -> Gundeck [Result s] +push :: NativePush -> [Address] -> Gundeck [Result] push _ [] = return [] push m [a] = pure <$> push1 m a push m addrs = mapConcurrently (push1 m) addrs -push1 :: Message s -> Address s -> Gundeck (Result s) +push1 :: NativePush -> Address -> Gundeck Result push1 m a = do e <- view awsEnv r <- Aws.execute e $ publish m a @@ -86,11 +85,11 @@ push1 m a = do i <- mkNotificationId let c = a^.addrClient let r = singleton (target (a^.addrUser) & targetClients .~ [c]) - let t = pushToken (a^.addrTransport) (a^.addrApp) (a^.addrToken) c + let t = a^.addrPushToken let p = singletonPayload (PushRemove t) Stream.add i r p =<< view (options.optSettings.setNotificationTTL) -publish :: Message s -> Address s -> Aws.Amazon (Result s) +publish :: NativePush -> Address -> Aws.Amazon Result publish m a = flip catches pushException $ do let ept = a^.addrEndpoint txt <- liftIO $ serialise m a @@ -113,7 +112,7 @@ publish m a = flip catches pushException $ do -- a newly created address in the second argument. If such a new address -- is given, shared owners of the deleted tokens have their addresses -- migrated to the token and endpoint of the new address. -deleteTokens :: [Address a] -> Maybe (Address a) -> Gundeck () +deleteTokens :: [Address] -> Maybe Address -> Gundeck () deleteTokens tokens new = do aws <- view awsEnv forM_ tokens $ \a -> do @@ -158,7 +157,7 @@ deleteTokens tokens new = do (a^.addrConn) (a^.addrClient) Data.delete u (a^.addrTransport) (a^.addrApp) oldTok -logError :: (Exception e, MonadLogger m) => Address s -> Text -> e -> m () +logError :: (Exception e, MonadLogger m) => Address -> Text -> e -> m () logError a m exn = Log.err $ field "user" (toByteString (a^.addrUser)) ~~ field "arn" (toText (a^.addrEndpoint)) diff --git a/services/gundeck/src/Gundeck/Push/Native/Serialise.hs b/services/gundeck/src/Gundeck/Push/Native/Serialise.hs index a5a5f6393b9..a0f038836fd 100644 --- a/services/gundeck/src/Gundeck/Push/Native/Serialise.hs +++ b/services/gundeck/src/Gundeck/Push/Native/Serialise.hs @@ -1,4 +1,3 @@ - module Gundeck.Push.Native.Serialise ( serialise , maxPayloadSize @@ -17,7 +16,7 @@ import qualified Data.ByteString as BS import qualified Data.Text.Lazy as LT import qualified Data.Text.Lazy.Builder as LTB -serialise :: Message s -> Address s -> IO (Either Failure LT.Text) +serialise :: NativePush -> Address -> IO (Either Failure LT.Text) serialise m a = do rs <- prepare m a case rs of @@ -26,9 +25,9 @@ serialise m a = do Nothing -> return $ Left PayloadTooLarge Just txt -> return $ Right txt -prepare :: Message s -> Address s -> IO (Either Failure (Value, Priority, Maybe ApsData)) +prepare :: NativePush -> Address -> IO (Either Failure (Value, Priority, Maybe ApsData)) prepare m a = case m of - Notice nid prio aps -> + NativePush nid prio aps -> let o = object [ "type" .= ("notice" :: Text) , "data" .= object ["id" .= nid] diff --git a/services/gundeck/src/Gundeck/Push/Native/Types.hs b/services/gundeck/src/Gundeck/Push/Native/Types.hs index 2122c8391e0..4b4aa2ce0b6 100644 --- a/services/gundeck/src/Gundeck/Push/Native/Types.hs +++ b/services/gundeck/src/Gundeck/Push/Native/Types.hs @@ -1,8 +1,7 @@ - module Gundeck.Push.Native.Types ( Result (..) , Failure (..) - , Message (..) + , NativePush (..) , Address (..) , addrUser , addrTransport @@ -12,6 +11,7 @@ module Gundeck.Push.Native.Types , addrConn , addrClient , addrEqualClient + , addrPushToken -- * Re-Exports , EndpointArn @@ -23,34 +23,41 @@ module Gundeck.Push.Native.Types ) where import Imports -import Control.Lens (makeLenses, (^.)) +import Control.Lens (makeLenses, (^.), view, Lens') import Data.Id (UserId, ConnId, ClientId) -import Data.Singletons.TypeLits (Symbol) import Gundeck.Aws.Arn import Gundeck.Types +import Gundeck.Types.Push.V2 (PushToken) -- | Native push address information of a device. --- --- REFACTOR: the @s@ phantom type can probably go away, too! --- REFACTOR: PushToken is embedded in this type, that should probably become a tree? especially since EnpointArn is also nested. -data Address (s :: Symbol) = Address +data Address = Address { _addrUser :: !UserId - , _addrTransport :: !Transport - , _addrApp :: !AppName - , _addrToken :: !Token , _addrEndpoint :: !EndpointArn , _addrConn :: !ConnId - , _addrClient :: !ClientId + , _addrPushToken :: !PushToken } deriving (Eq, Ord) makeLenses ''Address -addrEqualClient :: Address s -> Address s -> Bool -addrEqualClient a a' = _addrConn a == _addrConn a' - || _addrClient a == _addrClient a' +addrTransport :: Lens' Address Transport +addrTransport = addrPushToken . tokenTransport + +addrApp :: Lens' Address AppName +addrApp = addrPushToken . tokenApp + +addrToken :: Lens' Address Token +addrToken = addrPushToken . token + +addrClient :: Lens' Address ClientId +addrClient = addrPushToken . tokenClient + + +addrEqualClient :: Address -> Address -> Bool +addrEqualClient a a' = view addrConn a == view addrConn a' + || view addrClient a == view addrClient a' -instance Show (Address s) where +instance Show Address where show a = showString "Address" . showString "{ user = " . shows (a^.addrUser) . showString ", transport = " . shows (a^.addrTransport) @@ -60,9 +67,9 @@ instance Show (Address s) where . showString ", client = " . shows (a^.addrClient) $ "}" -data Result s - = Success !(Address s) - | Failure !Failure !(Address s) +data Result + = Success !Address + | Failure !Failure !Address data Failure = PayloadTooLarge @@ -71,9 +78,8 @@ data Failure | PushException !SomeException deriving (Show) --- | REFACTOR: rename to @data NativePush (s :: Symbol) = NativePush { ntvpNotificationId :: ...@ -data Message (s :: Symbol) = Notice - { msgNotificationid :: NotificationId - , msgPriority :: Priority - , msgApsData :: Maybe ApsData +data NativePush = NativePush + { npNotificationid :: NotificationId + , npPriority :: Priority + , npApsData :: Maybe ApsData } diff --git a/services/gundeck/src/Gundeck/Push/Websocket.hs b/services/gundeck/src/Gundeck/Push/Websocket.hs index d474ce725c2..313da2a38e9 100644 --- a/services/gundeck/src/Gundeck/Push/Websocket.hs +++ b/services/gundeck/src/Gundeck/Push/Websocket.hs @@ -1,4 +1,3 @@ - module Gundeck.Push.Websocket (push, bulkPush, MonadBulkPush(..)) where import Imports @@ -99,8 +98,10 @@ logBadCannons (uri, (err, prcs)) = do forM_ prcs $ \prc -> Log.warn $ logPresence prc ~~ Log.field "created_at" (ms $ createdAt prc) - ~~ Log.msg (val "WebSocket presence unreachable: " +++ - show (uri, resource prc, show err)) + ~~ Log.field "cannon_uri" (show uri) + ~~ Log.field "resource_target" (show $ resource prc) + ~~ Log.field "http_exception" (intercalate " | " . lines . show $ err) + ~~ Log.msg (val "WebSocket presence unreachable: ") logPrcsGone :: Log.MonadLogger m => Presence -> m () logPrcsGone prc = Log.debug $ logPresence prc ~~ Log.msg (val "WebSocket presence gone") diff --git a/services/gundeck/src/Gundeck/React.hs b/services/gundeck/src/Gundeck/React.hs index b273fb8907b..31f90c9901a 100644 --- a/services/gundeck/src/Gundeck/React.hs +++ b/services/gundeck/src/Gundeck/React.hs @@ -1,4 +1,3 @@ - -- | Curate native push tokens based on provider feedback reported -- via SNS events. module Gundeck.React (onEvent) where @@ -101,7 +100,7 @@ onUnhandledEventType ev = Log.warn $ withEndpoint :: Event - -> (SNSEndpoint -> [Address "no-keys"] -> Gundeck ()) + -> (SNSEndpoint -> [Address] -> Gundeck ()) -> Gundeck () withEndpoint ev f = do v <- view awsEnv diff --git a/services/gundeck/src/Gundeck/Util.hs b/services/gundeck/src/Gundeck/Util.hs index 3316f2e21dd..17b757b3bb6 100644 --- a/services/gundeck/src/Gundeck/Util.hs +++ b/services/gundeck/src/Gundeck/Util.hs @@ -1,4 +1,3 @@ - module Gundeck.Util where import Imports diff --git a/services/gundeck/src/Gundeck/Util/DelayQueue.hs b/services/gundeck/src/Gundeck/Util/DelayQueue.hs index 016a6c53314..d36fed4db8e 100644 --- a/services/gundeck/src/Gundeck/Util/DelayQueue.hs +++ b/services/gundeck/src/Gundeck/Util/DelayQueue.hs @@ -1,4 +1,3 @@ - module Gundeck.Util.DelayQueue ( DelayQueue , Clock (..) diff --git a/services/gundeck/src/Gundeck/Util/Redis.hs b/services/gundeck/src/Gundeck/Util/Redis.hs index b2d24bda564..09d5aebd330 100644 --- a/services/gundeck/src/Gundeck/Util/Redis.hs +++ b/services/gundeck/src/Gundeck/Util/Redis.hs @@ -1,4 +1,3 @@ - module Gundeck.Util.Redis where import Imports diff --git a/services/gundeck/test/bench/Main.hs b/services/gundeck/test/bench/Main.hs index 10d25d4b449..98a3e775285 100644 --- a/services/gundeck/test/bench/Main.hs +++ b/services/gundeck/test/bench/Main.hs @@ -1,4 +1,3 @@ - module Main (main) where import Imports @@ -27,14 +26,14 @@ notice :: IO Text notice = do i <- randomId a <- mkAddress GCM - let msg = Notice i HighPriority Nothing + let msg = NativePush i HighPriority Nothing Right txt <- serialise msg a return $! LT.toStrict txt ----------------------------------------------------------------------------- -- Utilities -mkAddress :: Transport -> IO (Address s) +mkAddress :: Transport -> IO Address mkAddress t = do u <- randomId let app = AppName "test" @@ -42,7 +41,7 @@ mkAddress t = do let tok = Token "test" let con = ConnId "conn" let clt = ClientId "client" - return $! Address u t app tok ept con clt + return $! Address u ept con (pushToken t app tok clt) mkEndpoint :: Transport -> AppName -> EndpointArn mkEndpoint t a = mkSnsArn Ireland (Account "test") topic diff --git a/services/gundeck/test/integration/API.hs b/services/gundeck/test/integration/API.hs index 9f1009f0726..b1cc4e48a46 100644 --- a/services/gundeck/test/integration/API.hs +++ b/services/gundeck/test/integration/API.hs @@ -1,4 +1,3 @@ - {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} module API (TestSetup(..), tests) where diff --git a/services/gundeck/test/integration/Main.hs b/services/gundeck/test/integration/Main.hs index 0440a4102a8..4e5ca48c652 100644 --- a/services/gundeck/test/integration/Main.hs +++ b/services/gundeck/test/integration/Main.hs @@ -1,4 +1,3 @@ - module Main (main) where import Imports hiding (local) diff --git a/services/gundeck/test/unit/DelayQueue.hs b/services/gundeck/test/unit/DelayQueue.hs index 6ee62371a39..800edc4cc3c 100644 --- a/services/gundeck/test/unit/DelayQueue.hs +++ b/services/gundeck/test/unit/DelayQueue.hs @@ -1,4 +1,3 @@ - module DelayQueue where import Imports diff --git a/services/gundeck/test/unit/Json.hs b/services/gundeck/test/unit/Json.hs index 026e3f281b0..b3df0762cd9 100644 --- a/services/gundeck/test/unit/Json.hs +++ b/services/gundeck/test/unit/Json.hs @@ -1,4 +1,3 @@ - module Json where import Imports diff --git a/services/gundeck/test/unit/MockGundeck.hs b/services/gundeck/test/unit/MockGundeck.hs index 7a818053902..972049bc7d3 100644 --- a/services/gundeck/test/unit/MockGundeck.hs +++ b/services/gundeck/test/unit/MockGundeck.hs @@ -68,7 +68,7 @@ import qualified Network.URI as URI type Payload = List1 Aeson.Object data ClientInfo = ClientInfo - { _ciNativeAddress :: Maybe (Address "no-keys", Bool{- reachable -}) + { _ciNativeAddress :: Maybe (Address, Bool{- reachable -}) , _ciWSReachable :: Bool } deriving (Eq, Show) @@ -116,7 +116,7 @@ instance ToJSON ClientInfo where , "wsReachable" Aeson..= wsreach ] -instance ToJSON (Address s) where +instance ToJSON Address where toJSON adr = Aeson.object [ "user" Aeson..= (adr ^. addrUser) , "transport" Aeson..= (adr ^. addrTransport) @@ -143,15 +143,16 @@ instance FromJSON ClientInfo where <$> (cinfo Aeson..: "native") <*> (cinfo Aeson..: "wsReachable") -instance FromJSON (Address s) where +instance FromJSON Address where parseJSON = withObject "Address" $ \adr -> Address <$> (adr Aeson..: "user") - <*> (adr Aeson..: "transport") - <*> (adr Aeson..: "app") - <*> (adr Aeson..: "token") <*> (mkFakeAddrEndpoint <$> adr Aeson..: "endpoint") <*> (adr Aeson..: "conn") - <*> (adr Aeson..: "client") + <*> (pushToken + <$> (adr Aeson..: "transport") + <*> (adr Aeson..: "app") + <*> (adr Aeson..: "token") + <*> (adr Aeson..: "client")) mkFakeAddrEndpoint :: (Text, Transport, AppName) -> EndpointArn mkFakeAddrEndpoint (epid, transport, app) = Aws.mkSnsArn Tokyo (Account "acc") eptopic @@ -258,9 +259,8 @@ genRecipient' env uid = do ] pure $ Recipient uid route cids --- REFACTOR: see 'Route' type about missing 'RouteNative'. genRoute :: HasCallStack => Gen Route -genRoute = QC.elements [RouteAny, RouteDirect] +genRoute = QC.elements [minBound..] genId :: Gen (Id a) genId = do @@ -270,14 +270,14 @@ genId = do genClientId :: Gen ClientId genClientId = newClientId <$> arbitrary -genProtoAddress :: HasCallStack => UserId -> ClientId -> Gen (Address "no-keys") +genProtoAddress :: HasCallStack => UserId -> ClientId -> Gen Address genProtoAddress _addrUser _addrClient = do _addrTransport :: Transport <- QC.elements [minBound..] arnEpId :: Text <- arbitrary let _addrApp = "AppName" - _addrToken = Token "tok" _addrEndpoint = mkFakeAddrEndpoint (arnEpId, _addrTransport, _addrApp) _addrConn = fakeConnId _addrClient + _addrPushToken = pushToken _addrTransport _addrApp (Token "tok") _addrClient pure Address {..} genPushes :: MockEnv -> Gen [Push] @@ -396,7 +396,7 @@ instance MonadPushAll MockGundeck where instance MonadNativeTargets MockGundeck where mntgtLogErr _ = pure () - mntgtLookupAddress = mockLookupAddress + mntgtLookupAddresses = mockLookupAddresses mntgtMapAsync f xs = Right <$$> mapM f xs -- (no concurrency) instance MonadPushAny MockGundeck where @@ -556,17 +556,17 @@ mockStreamAdd _ (toList -> targets) pay _ = mockPushNative :: (HasCallStack, m ~ MockGundeck) - => Notification -> Push -> [Address "no-keys"] -> m () + => Notification -> Push -> [Address] -> m () mockPushNative _nid ((^. pushPayload) -> payload) addrs = do env <- ask forM_ addrs $ \addr -> do when (nativeReachableAddr env addr) $ msNativeQueue %= deliver (addr ^. addrUser, addr ^. addrClient) payload -mockLookupAddress +mockLookupAddresses :: (HasCallStack, m ~ MockGundeck) - => UserId -> m [Address "no-keys"] -mockLookupAddress uid = do + => UserId -> m [Address] +mockLookupAddresses uid = do cinfos :: [ClientInfo] <- Map.elems . fromMaybe (error $ "mockLookupAddress: unknown UserId: " <> show uid) . @@ -688,7 +688,7 @@ nativeReachable :: MockEnv -> (UserId, ClientId) -> Bool nativeReachable (MockEnv mp) (uid, cid) = maybe False (^. _2) $ (Map.lookup uid >=> Map.lookup cid >=> (^. ciNativeAddress)) mp -nativeReachableAddr :: MockEnv -> Address s -> Bool +nativeReachableAddr :: MockEnv -> Address -> Bool nativeReachableAddr env addr = nativeReachable env (addr ^. addrUser, addr ^. addrClient) allUsers :: MockEnv -> [UserId] diff --git a/services/gundeck/test/unit/Native.hs b/services/gundeck/test/unit/Native.hs index 522eed421f1..4061834b978 100644 --- a/services/gundeck/test/unit/Native.hs +++ b/services/gundeck/test/unit/Native.hs @@ -1,4 +1,3 @@ - module Native where import Imports @@ -131,21 +130,18 @@ randNotif size = do let pload = List1.singleton (HashMap.fromList ["data" .= v]) Notification i <$> arbitrary <*> pure pload -randMessage :: Notification -> IO (Message "keys") -randMessage n = pure $ Notice (ntfId n) HighPriority Nothing +randMessage :: Notification -> IO NativePush +randMessage n = pure $ NativePush (ntfId n) HighPriority Nothing ----------------------------------------------------------------------------- -- Utilities -mkAddress :: Transport -> IO (Address "keys") +mkAddress :: Transport -> IO Address mkAddress t = Address <$> randomId - <*> pure t - <*> pure (AppName "test") - <*> pure (Token "test") <*> pure (mkEndpoint t (AppName "test")) <*> pure (ConnId "conn") - <*> pure (ClientId "client") + <*> pure (pushToken t (AppName "test") (Token "test") (ClientId "client")) mkEndpoint :: Transport -> AppName -> EndpointArn mkEndpoint t a = mkSnsArn Ireland (Account "test") topic diff --git a/services/proxy/src/Proxy/API.hs b/services/proxy/src/Proxy/API.hs index a3b6d65f099..6916da069e1 100644 --- a/services/proxy/src/Proxy/API.hs +++ b/services/proxy/src/Proxy/API.hs @@ -1,4 +1,3 @@ - module Proxy.API (Proxy.API.run) where import Imports hiding (head) diff --git a/services/proxy/src/Proxy/Env.hs b/services/proxy/src/Proxy/Env.hs index d295c18512e..b982cfb4d1a 100644 --- a/services/proxy/src/Proxy/Env.hs +++ b/services/proxy/src/Proxy/Env.hs @@ -1,4 +1,3 @@ - module Proxy.Env ( Env , createEnv diff --git a/services/proxy/src/Proxy/Options.hs b/services/proxy/src/Proxy/Options.hs index 1387207daac..1b70dedc7b1 100644 --- a/services/proxy/src/Proxy/Options.hs +++ b/services/proxy/src/Proxy/Options.hs @@ -1,4 +1,3 @@ - module Proxy.Options ( Opts , host diff --git a/services/spar/schema/src/Main.hs b/services/spar/schema/src/Main.hs index d741297c828..b7e22e7a17f 100644 --- a/services/spar/schema/src/Main.hs +++ b/services/spar/schema/src/Main.hs @@ -1,4 +1,3 @@ - module Main where import Imports diff --git a/services/spar/schema/src/V0.hs b/services/spar/schema/src/V0.hs index 24171e1a15c..9743bf3aa1d 100644 --- a/services/spar/schema/src/V0.hs +++ b/services/spar/schema/src/V0.hs @@ -1,4 +1,3 @@ - module V0 (migration) where import Imports diff --git a/services/spar/schema/src/V1.hs b/services/spar/schema/src/V1.hs index 8ac4eaf4fa3..1014d83ce35 100644 --- a/services/spar/schema/src/V1.hs +++ b/services/spar/schema/src/V1.hs @@ -1,4 +1,3 @@ - module V1 (migration) where import Imports diff --git a/services/spar/schema/src/V2.hs b/services/spar/schema/src/V2.hs index 32947e31b66..dc6d37d999e 100644 --- a/services/spar/schema/src/V2.hs +++ b/services/spar/schema/src/V2.hs @@ -1,4 +1,3 @@ - module V2 (migration) where import Imports diff --git a/services/spar/schema/src/V3.hs b/services/spar/schema/src/V3.hs index 1a64d4a45d9..ee2f5355e33 100644 --- a/services/spar/schema/src/V3.hs +++ b/services/spar/schema/src/V3.hs @@ -1,4 +1,3 @@ - module V3 (migration) where import Imports diff --git a/services/spar/schema/src/V4.hs b/services/spar/schema/src/V4.hs index 3bc477ae5c0..73e47746eba 100644 --- a/services/spar/schema/src/V4.hs +++ b/services/spar/schema/src/V4.hs @@ -1,4 +1,3 @@ - module V4 (migration) where import Imports diff --git a/services/spar/src/Spar/API/Swagger.hs b/services/spar/src/Spar/API/Swagger.hs index d54fe61c728..462e4ae2b8c 100644 --- a/services/spar/src/Spar/API/Swagger.hs +++ b/services/spar/src/Spar/API/Swagger.hs @@ -76,6 +76,9 @@ Centrify allows you to upload the metadata xml document that you get from the `/ samlSchemaOptions :: SchemaOptions samlSchemaOptions = Swagger.fromAesonOptions SAML.deriveJSONOptions +instance ToSchema SAML.XmlText where + declareNamedSchema = genericDeclareNamedSchema samlSchemaOptions + instance ToParamSchema (Id a) where toParamSchema _ = toParamSchema (Proxy @UUID) diff --git a/services/spar/src/Spar/API/Util.hs b/services/spar/src/Spar/API/Util.hs index 8bfcedf75ac..c42e58638e6 100644 --- a/services/spar/src/Spar/API/Util.hs +++ b/services/spar/src/Spar/API/Util.hs @@ -1,4 +1,3 @@ - -- | Swagger utilities. module Spar.API.Util where diff --git a/services/spar/src/Spar/Data.hs b/services/spar/src/Spar/Data.hs index 2f3f027501a..5e579883e5a 100644 --- a/services/spar/src/Spar/Data.hs +++ b/services/spar/src/Spar/Data.hs @@ -117,7 +117,7 @@ storeAReqID (SAML.ID rid) (SAML.Time endOfLife) = do TTL ttl <- mkTTLAuthnRequests env endOfLife retry x5 . write ins $ params Quorum (rid, ttl) where - ins :: PrepQuery W (ST, Int32) () + ins :: PrepQuery W (SAML.XmlText, Int32) () ins = "INSERT INTO authreq (req) VALUES (?) USING TTL ?" unStoreAReqID @@ -125,7 +125,7 @@ unStoreAReqID => AReqId -> m () unStoreAReqID (SAML.ID rid) = retry x5 . write del . params Quorum $ Identity rid where - del :: PrepQuery W (Identity ST) () + del :: PrepQuery W (Identity SAML.XmlText) () del = "DELETE FROM authreq WHERE req = ?" isAliveAReqID @@ -134,7 +134,7 @@ isAliveAReqID isAliveAReqID (SAML.ID rid) = (==) (Just 1) <$> (retry x1 . query1 sel . params Quorum $ Identity rid) where - sel :: PrepQuery R (Identity ST) (Identity Int64) + sel :: PrepQuery R (Identity SAML.XmlText) (Identity Int64) sel = "SELECT COUNT(*) FROM authreq WHERE req = ?" @@ -146,7 +146,7 @@ storeAssID (SAML.ID aid) (SAML.Time endOfLife) = do TTL ttl <- mkTTLAssertions env endOfLife retry x5 . write ins $ params Quorum (aid, ttl) where - ins :: PrepQuery W (ST, Int32) () + ins :: PrepQuery W (SAML.XmlText, Int32) () ins = "INSERT INTO authresp (resp) VALUES (?) USING TTL ?" unStoreAssID @@ -154,7 +154,7 @@ unStoreAssID => AssId -> m () unStoreAssID (SAML.ID aid) = retry x5 . write del . params Quorum $ Identity aid where - del :: PrepQuery W (Identity ST) () + del :: PrepQuery W (Identity SAML.XmlText) () del = "DELETE FROM authresp WHERE resp = ?" isAliveAssID @@ -163,7 +163,7 @@ isAliveAssID isAliveAssID (SAML.ID aid) = (==) (Just 1) <$> (retry x1 . query1 sel . params Quorum $ Identity aid) where - sel :: PrepQuery R (Identity ST) (Identity Int64) + sel :: PrepQuery R (Identity SAML.XmlText) (Identity Int64) sel = "SELECT COUNT(*) FROM authresp WHERE resp = ?" diff --git a/services/spar/src/Spar/Data/Instances.hs b/services/spar/src/Spar/Data/Instances.hs index afe186f98cd..db72573f120 100644 --- a/services/spar/src/Spar/Data/Instances.hs +++ b/services/spar/src/Spar/Data/Instances.hs @@ -28,6 +28,13 @@ import qualified SAML2.WebSSO as SAML import qualified Web.Scim.Class.User as Scim +instance Cql SAML.XmlText where + ctype = Tagged TextColumn + toCql = CqlText . SAML.unsafeFromXmlText + + fromCql (CqlText t) = pure $ SAML.mkXmlText t + fromCql _ = fail "XmlText: expected CqlText" + instance Cql (SignedCertificate) where ctype = Tagged BlobColumn toCql = CqlBlob . cs . renderKeyInfo @@ -39,14 +46,14 @@ instance Cql (URIRef Absolute) where ctype = Tagged TextColumn toCql = CqlText . SAML.renderURI - fromCql (CqlText t) = parseURI' $ t + fromCql (CqlText t) = parseURI' t fromCql _ = fail "URI: expected CqlText" instance Cql SAML.NameID where ctype = Tagged TextColumn toCql = CqlText . cs . SAML.encodeElem - fromCql (CqlText t) = SAML.decodeElem . cs $ t + fromCql (CqlText t) = SAML.decodeElem (cs t) fromCql _ = fail "NameID: expected CqlText" deriving instance Cql SAML.Issuer diff --git a/services/spar/src/Spar/Scim/Auth.hs b/services/spar/src/Spar/Scim/Auth.hs index 48be8482930..e5276f65b8f 100644 --- a/services/spar/src/Spar/Scim/Auth.hs +++ b/services/spar/src/Spar/Scim/Auth.hs @@ -95,6 +95,9 @@ createScimToken zusr CreateScimToken{..} = do } wrapMonadClient $ Data.insertScimToken token info pure $ CreateScimTokenResponse token info + + -- NB: if the two following cases do not result in errors, 'validateScimUser' needs to + -- be changed. currently, it relies on the fact that there is always an IdP. [] -> throwSpar $ SparProvisioningNoSingleIdP "SCIM tokens can only be created for a team with an IdP, \ \but none are found" diff --git a/services/spar/src/Spar/Scim/User.hs b/services/spar/src/Spar/Scim/User.hs index 503f80727e9..b70fcd241e4 100644 --- a/services/spar/src/Spar/Scim/User.hs +++ b/services/spar/src/Spar/Scim/User.hs @@ -110,11 +110,19 @@ instance Scim.UserDB Spar where delete :: ScimTokenInfo -> Text -> Scim.ScimHandler Spar Bool delete _ _ = - throwError $ Scim.serverError "User delete is not implemented yet" -- TODO + throwError $ Scim.ScimError + mempty + (Scim.Status 404) + Nothing + (Just "User delete is not implemented yet") -- TODO getMeta :: ScimTokenInfo -> Scim.ScimHandler Spar Scim.Meta getMeta _ = - throwError $ Scim.serverError "User getMeta is not implemented yet" -- TODO + throwError $ Scim.ScimError + mempty + (Scim.Status 404) + Nothing + (Just "User getMeta is not implemented yet") -- TODO ---------------------------------------------------------------------------- -- User creation and validation @@ -128,13 +136,12 @@ validateScimUser validateScimUser ScimTokenInfo{stiIdP} user = do idp <- case stiIdP of Nothing -> throwError $ - Scim.serverError "No IdP configured for the provisioning token" + Scim.serverError "No IdP configured for the provisioning token" Just idp -> lift (wrapMonadClient (Data.getIdPConfig idp)) >>= \case Nothing -> throwError $ - Scim.serverError "The IdP corresponding to the provisioning token \ - \was not found" + Scim.serverError "The IdP configured for this provisioning token not found" Just idpConfig -> pure idpConfig - validateScimUser' (Just idp) user + validateScimUser' idp user -- | Map the SCIM data on the spar and brig schemata, and throw errors if the SCIM data does -- not comply with the standard / our constraints. See also: 'ValidScimUser'. @@ -162,12 +169,10 @@ validateScimUser ScimTokenInfo{stiIdP} user = do -- Brig. See . validateScimUser' :: forall m. (MonadError Scim.ScimError m) - => Maybe IdP -- ^ IdP that the resulting user will be assigned to + => IdP -- ^ IdP that the resulting user will be assigned to -> Scim.User -> m ValidScimUser -validateScimUser' Nothing _ = - throwError $ Scim.serverError "SCIM users without SAML SSO are not supported" -validateScimUser' (Just idp) user = do +validateScimUser' idp user = do uref :: SAML.UserRef <- case Scim.externalId user of Just subjectTxt -> do let issuer = idp ^. SAML.idpMetadata . SAML.edIssuer @@ -183,13 +188,20 @@ validateScimUser' (Just idp) user = do -- Validate a subject ID (@externalId@). validateSubject :: Text -> m SAML.NameID validateSubject txt = do - let unameId = case parseEmail txt of - Just _ -> SAML.UNameIDEmail txt - Nothing -> SAML.UNameIDUnspecified txt + unameId :: SAML.UnqualifiedNameID <- do + let eEmail = SAML.mkUNameIDEmail txt + unspec = SAML.mkUNameIDUnspecified txt + pure . either (const unspec) id $ eEmail case SAML.mkNameID unameId Nothing Nothing Nothing of Right nameId -> pure nameId - Left err -> throwError $ Scim.serverError - ("Can't construct a subject ID from externalId: " <> Text.pack err) + Left err -> throwError $ Scim.ScimError + mempty + (Scim.Status 400) + Nothing + (Just $ "Can't construct a subject ID from externalId: " <> Text.pack err) + -- This cannot happen at the time of writing this comment, but there may be + -- valid scenarios in the future where this is not an internal error, eg. URI + -- too long. See 'mkNameID' for all possible errors. -- Validate a handle (@userName@). validateHandle :: Text -> m Handle @@ -268,7 +280,9 @@ updateValidScimUser tokinfo uidText newScimUser = do lift . wrapMonadClient $ Data.insertUser uref uid -- on spar bindok <- lift $ Intra.Brig.bindUser uid uref -- on brig unless bindok . throwError $ - Scim.serverError "Failed to update SAML UserRef (no such UserId? duplicate Handle?)" + Scim.serverError "Failed to update SAML UserRef on brig." + -- this can only happen if user is found in spar.scim_user, but missing on brig. + -- (internal error? race condition?) maybe (pure ()) (lift . Intra.Brig.setName uid) $ newScimUser ^. vsuName lift . Intra.Brig.setHandle uid $ newScimUser ^. vsuHandle diff --git a/services/spar/test-integration/Spec.hs b/services/spar/test-integration/Spec.hs index 1d0515e1a99..256d9ad8545 100644 --- a/services/spar/test-integration/Spec.hs +++ b/services/spar/test-integration/Spec.hs @@ -1,4 +1,3 @@ - -- | It would be nice to use hspec-discover, which even has support for -- . -- diff --git a/services/spar/test-integration/Test/Spar/APISpec.hs b/services/spar/test-integration/Test/Spar/APISpec.hs index 3cf4d86174a..da0b28e1802 100644 --- a/services/spar/test-integration/Test/Spar/APISpec.hs +++ b/services/spar/test-integration/Test/Spar/APISpec.hs @@ -1,4 +1,3 @@ - module Test.Spar.APISpec (spec) where import Imports hiding (head) @@ -670,7 +669,8 @@ specScimAndSAML = do let userid :: UserId = ScimT.scimUserId scimStoredUser userref :: UserRef = UserRef tenant subject tenant :: Issuer = idp ^. idpMetadata . edIssuer - subject :: NameID = NameID subj Nothing Nothing Nothing + subject :: NameID = either (error . show) id $ + mkNameID subj Nothing Nothing Nothing -- UserRef maps onto correct UserId in spar (and back). userid' <- getUserIdViaRef' userref diff --git a/services/spar/test-integration/Test/Spar/DataSpec.hs b/services/spar/test-integration/Test/Spar/DataSpec.hs index a066a62b815..34f32421891 100644 --- a/services/spar/test-integration/Test/Spar/DataSpec.hs +++ b/services/spar/test-integration/Test/Spar/DataSpec.hs @@ -25,6 +25,16 @@ import Web.Scim.Schema.Common as Scim.Common spec :: SpecWith TestEnv spec = do + describe "Cql rountrip" $ do + let check + :: forall a. (Cql a, Typeable a, Show a, Eq a) + => a -> SpecWith TestEnv + check x = it (show . typeRep $ (Proxy @a)) . liftIO $ do + (fromCql . toCql) x `shouldBe` Right x + + check (mkXmlText "<>%&'\"") + -- FUTUREWORK: collect all Cql instance, make them Arbitrary instances, and do this right. + describe "TTL" $ do it "works in seconds" $ do env <- ask diff --git a/services/spar/test-integration/Test/Spar/Intra/BrigSpec.hs b/services/spar/test-integration/Test/Spar/Intra/BrigSpec.hs index 82a45e49ef7..0fbf5ee3000 100644 --- a/services/spar/test-integration/Test/Spar/Intra/BrigSpec.hs +++ b/services/spar/test-integration/Test/Spar/Intra/BrigSpec.hs @@ -1,4 +1,3 @@ - module Test.Spar.Intra.BrigSpec (spec) where import Imports hiding (head) diff --git a/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs b/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs index 00a9c04cfca..1c658471036 100644 --- a/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs +++ b/services/spar/test-integration/Test/Spar/Scim/UserSpec.hs @@ -27,12 +27,8 @@ spec = do specListUsers specGetUser specUpdateUser + specDeleteUser - describe "DELETE /Users" $ do - it "responds with 404 (just making sure...)" $ pending - describe "DELETE /Users/:id" $ do - it "sets the 'deleted' flag in brig, and does nothing otherwise." $ - pendingWith "really? how do we destroy the data then, and when?" describe "CRUD operations maintain invariants in mapScimToBrig, mapBrigToScim." $ do it "..." $ do pendingWith "this is a job for quickcheck-state-machine" @@ -203,7 +199,7 @@ testListNoDeletedUsers = do storedUser <- createUser tok user let userid = scimUserId storedUser -- Delete the user (TODO: do it via SCIM) - call $ deleteUser (env ^. teBrig) userid + call $ deleteUserOnBrig (env ^. teBrig) userid -- Get all users users <- listUsers tok Nothing -- Check that the user is absent @@ -259,7 +255,7 @@ testGetNoDeletedUsers = do storedUser <- createUser tok user let userid = scimUserId storedUser -- Delete the user - call $ deleteUser (env ^. teBrig) userid + call $ deleteUserOnBrig (env ^. teBrig) userid -- Try to find the user getUser_ (Just tok) userid (env ^. teSpar) !!! const 404 === statusCode @@ -410,7 +406,7 @@ testUpdateUserRefIndex = do -- Overwrite the user with another randomly-generated user user' <- randomScimUser _ <- updateUser tok userid user' - vuser' <- either (error . show) pure $ validateScimUser' (Just idp) user' + vuser' <- either (error . show) pure $ validateScimUser' idp user' muserid' <- runSparCass $ Data.getUser (vuser' ^. vsuSAMLUserRef) liftIO $ do muserid' `shouldBe` Just userid @@ -424,6 +420,30 @@ testBrigSideIsUpdated = do user' <- randomScimUser let userid = scimUserId storedUser _ <- updateUser tok userid user' - validScimUser <- either (error . show) pure $ validateScimUser' (Just idp) user' + validScimUser <- either (error . show) pure $ validateScimUser' idp user' brigUser <- maybe (error "no brig user") pure =<< getSelf userid brigUser `userShouldMatch` validScimUser + +---------------------------------------------------------------------------- +-- Deleting users + +specDeleteUser :: SpecWith TestEnv +specDeleteUser = do + describe "DELETE /Users" $ do + it "responds with 405 (just making sure...)" $ do + env <- ask + (tok, _) <- registerIdPAndScimToken + deleteUser_ (Just tok) Nothing (env ^. teSpar) + !!! const 405 === statusCode + + describe "DELETE /Users/:id" $ do + it "whether implemented or not, does *NOT EVER* respond with 5xx!" $ do + env <- ask + user <- randomScimUser + (tok, _) <- registerIdPAndScimToken + storedUser <- createUser tok user + deleteUser_ (Just tok) (Just $ scimUserId storedUser) (env ^. teSpar) + !!! assertTrue_ (inRange (200, 499) . statusCode) + + it "sets the 'deleted' flag in brig, and does nothing otherwise." $ + pendingWith "really? how do we destroy the data then, and when?" diff --git a/services/spar/test-integration/Util/Core.hs b/services/spar/test-integration/Util/Core.hs index 4ac66345f09..02f7dd0370e 100644 --- a/services/spar/test-integration/Util/Core.hs +++ b/services/spar/test-integration/Util/Core.hs @@ -27,7 +27,7 @@ module Util.Core , defPassword , createUserWithTeam , createTeamMember - , deleteUser + , deleteUserOnBrig , getTeams , getSelfProfile , nextWireId @@ -252,9 +252,9 @@ addTeamMember galleyreq tid mem = ) -- | Delete a user from Brig and wait until it's gone. -deleteUser :: (HasCallStack, MonadMask m, MonadCatch m, MonadIO m, MonadHttp m) +deleteUserOnBrig :: (HasCallStack, MonadMask m, MonadCatch m, MonadIO m, MonadHttp m) => BrigReq -> UserId -> m () -deleteUser brigreq uid = do +deleteUserOnBrig brigreq uid = do deleteUserNoWait brigreq uid recoverAll (exponentialBackoff 30000 <> limitRetries 5) $ \_ -> do profile <- getSelfProfile brigreq uid @@ -275,16 +275,16 @@ nextWireId :: MonadIO m => m (Id a) nextWireId = Id <$> liftIO UUID.nextRandom nextSAMLID :: MonadIO m => m (ID a) -nextSAMLID = ID . UUID.toText <$> liftIO UUID.nextRandom +nextSAMLID = mkID . UUID.toText <$> liftIO UUID.nextRandom -- | Generate a 'SAML.UserRef' subject. -nextSubject :: MonadIO m => m NameID +nextSubject :: (HasCallStack, MonadIO m) => m NameID nextSubject = liftIO $ do unameId <- randomRIO (0, 1::Int) >>= \case - 0 -> SAML.UNameIDEmail . Brig.fromEmail <$> randomEmail - 1 -> SAML.UNameIDUnspecified . UUID.toText <$> UUID.nextRandom + 0 -> either (error . show) id . SAML.mkUNameIDEmail . Brig.fromEmail <$> randomEmail + 1 -> SAML.mkUNameIDUnspecified . UUID.toText <$> UUID.nextRandom _ -> error "nextSubject: impossible" - pure $ SAML.NameID unameId Nothing Nothing Nothing + either (error . show) pure $ SAML.mkNameID unameId Nothing Nothing Nothing nextUserRef :: MonadIO m => m SAML.UserRef nextUserRef = liftIO $ do diff --git a/services/spar/test-integration/Util/Scim.hs b/services/spar/test-integration/Util/Scim.hs index 43a08bf2515..13fcb352a03 100644 --- a/services/spar/test-integration/Util/Scim.hs +++ b/services/spar/test-integration/Util/Scim.hs @@ -74,7 +74,9 @@ randomScimUser = fst <$> randomScimUserWithSubject -- | Like 'randomScimUser', but also returns the intended subject ID that the user should -- have. It's already available as 'Scim.User.externalId' but it's not structured. -randomScimUserWithSubject :: MonadRandom m => m (Scim.User.User, SAML.UnqualifiedNameID) +randomScimUserWithSubject + :: (HasCallStack, MonadRandom m) + => m (Scim.User.User, SAML.UnqualifiedNameID) randomScimUserWithSubject = do suffix <- cs <$> replicateM 5 (getRandomR ('0', '9')) emails <- getRandomR (0, 3) >>= \n -> replicateM n randomScimEmail @@ -82,10 +84,11 @@ randomScimUserWithSubject = do -- Related, but non-trivial to re-use here: 'nextSubject' (externalId, subj) <- getRandomR (0, 1::Int) <&> \case 0 -> ( "scimuser_extid_" <> suffix <> "@example.com" - , SAML.UNameIDEmail ("scimuser_extid_" <> suffix <> "@example.com") + , either (error . show) id $ + SAML.mkUNameIDEmail ("scimuser_extid_" <> suffix <> "@example.com") ) 1 -> ( "scimuser_extid_" <> suffix - , SAML.UNameIDUnspecified ("scimuser_extid_" <> suffix) + , SAML.mkUNameIDUnspecified ("scimuser_extid_" <> suffix) ) _ -> error "randomScimUserWithSubject: impossible" pure ( Scim.User.empty @@ -154,6 +157,21 @@ updateUser tok userid user = do ScimToken + -> UserId + -> TestSpar Scim.StoredUser +deleteUser tok userid = do + env <- ask + r <- deleteUser_ + (Just tok) + (Just userid) + (env ^. teSpar) + Maybe UserId -- ^ User to update; when not provided, the request will return 4xx + -> SparReq -- ^ Spar endpoint + -> TestSpar ResponseLBS +deleteUser_ auth uid spar_ = do + call . delete $ + ( spar_ + . paths (["scim", "v2", "Users"] <> (toByteString' <$> maybeToList uid)) + . scimAuth auth + . contentScim + . acceptScim + ) + -- | List all users. listUsers_ :: Maybe ScimToken -- ^ Authentication diff --git a/services/spar/test/Test/Spar/Intra/BrigSpec.hs b/services/spar/test/Test/Spar/Intra/BrigSpec.hs index 194b09d8c97..2ebcb8a6abf 100644 --- a/services/spar/test/Test/Spar/Intra/BrigSpec.hs +++ b/services/spar/test/Test/Spar/Intra/BrigSpec.hs @@ -26,7 +26,8 @@ spec = do it "example" $ do let have = UserRef (Issuer $ mkuri "http://wire.com/") - (NameID (UNameIDTransient "V") (Just "kati") (Just "rolli") (Just "jaan")) + (either (error . show) id $ + mkNameID (mkUNameIDTransient "V") (Just "kati") (Just "rolli") (Just "jaan")) want = UserSSOId "http://wire.com/" "V" @@ -36,7 +37,8 @@ spec = do it "another example" $ do let have = UserRef (Issuer $ mkuri "http://wire.com/") - (NameID (UNameIDPersistent "PWkS") (Just "hendrik") Nothing (Just "marye")) + (either (error . show) id $ + mkNameID (mkUNameIDPersistent "PWkS") (Just "hendrik") Nothing (Just "marye")) want = UserSSOId "http://wire.com/" "PWkS" diff --git a/services/start-services-only.sh b/services/start-services-only.sh new file mode 100755 index 00000000000..344d00e5a25 --- /dev/null +++ b/services/start-services-only.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Run all haskell services without immediately starting a test executable. +# Can be useful for manually poking at the API. + +# This is NOT intended for a demo with the external API, as nginz is missing here - see the demo.sh script in wire-server/deploy/services-demo for that instead. + +set -eo pipefail + +SERVICES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# call integration.sh, show a message, then sleep (instead of executing a test executable) +"$SERVICES_DIR/integration.sh" bash -c 'printf "(This will hang, Control+C to close.)\nNow you can manually curl them or start an integration test executable manually with e.g. \n(first cd to a service dir for correct working directory)\n cd services/brig && ../../dist/brig-integration -s brig.integration.yaml -i ../integration.yaml\n" && sleep 1000000' diff --git a/stack.yaml b/stack.yaml index 142baeedc5d..d8b487cb561 100644 --- a/stack.yaml +++ b/stack.yaml @@ -38,7 +38,7 @@ packages: extra-deps: - git: https://github.com/wireapp/saml2-web-sso - commit: 04e0bef9e87853567b8e063f1dcf91e0dd097593 # master (Feb 13, 2019) + commit: c03d17d656ac467350c983d5f844c199e5daceea # master (Feb 21, 2019) - git: https://github.com/wireapp/hscim commit: 53db8029e17e7085322e7055f71efb5e7058d4a5 # master (Jan 23, 2019)