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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions cassandra-schema.cql
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,6 @@ CREATE TABLE brig_test.rich_info (
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE brig_test.user_keys_hash (
key blob PRIMARY KEY,
key_type int,
user uuid
) WITH bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE brig_test.service_tag (
bucket int,
tag bigint,
Expand Down
7 changes: 0 additions & 7 deletions integration/test/API/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -592,13 +592,6 @@ legalholdUserStatus tid ownerid user = do
req <- baseRequest ownerid Galley Versioned (joinHttpPath ["teams", tidS, "legalhold", uid])
submit "GET" req

-- | https://staging-nginz-https.zinfra.io/v5/api/swagger-ui/#/default/post_teams__tid__legalhold_settings
enableLegalHold :: (HasCallStack, MakesValue tid, MakesValue ownerid) => tid -> ownerid -> App Response
enableLegalHold tid ownerid = do
tidStr <- asString tid
req <- baseRequest ownerid Galley Versioned (joinHttpPath ["teams", tidStr, "features", "legalhold"])
submit "PUT" (addJSONObject ["status" .= "enabled", "ttl" .= "unlimited"] req)

-- | https://staging-nginz-https.zinfra.io/v5/api/swagger-ui/#/default/delete_teams__tid__legalhold__uid_
disableLegalHold ::
(HasCallStack, MakesValue tid, MakesValue ownerid, MakesValue uid) =>
Expand Down
15 changes: 0 additions & 15 deletions integration/test/Testlib/Assertions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,6 @@ shouldMatchWithMsg msg a b = do
else pure ""
assertFailure $ (maybe "" (<> "\n") msg) <> "Actual:\n" <> pa <> "\nExpected:\n" <> pb <> diff

-- | apply some canonicalization transformations that *usually* do not change semantics before
-- comparing.
shouldMatchLeniently :: (MakesValue a, MakesValue b, HasCallStack) => a -> b -> App ()
shouldMatchLeniently = shouldMatchWithRules [EmptyArrayIsNull, RemoveNullFieldsFromObjects] (const $ pure Nothing)

-- | apply *all* canonicalization transformations before comparing. some of these may not be
-- valid on your input, see 'LenientMatchRule' for details.
shouldMatchSloppily :: (MakesValue a, MakesValue b, HasCallStack) => a -> b -> App ()
shouldMatchSloppily = shouldMatchWithRules [minBound ..] (const $ pure Nothing)

-- | apply *all* canonicalization transformations before comparing. some of these may not be
-- valid on your input, see 'LenientMatchRule' for details.
shouldMatchALittle :: (MakesValue a, MakesValue b, HasCallStack) => (Aeson.Value -> App (Maybe Aeson.Value)) -> a -> b -> App ()
shouldMatchALittle = shouldMatchWithRules [minBound ..]

data LenientMatchRule
= EmptyArrayIsNull
| ArraysAreSets
Expand Down
2 changes: 1 addition & 1 deletion libs/extended/src/Data/Time/Clock/DiffTime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ where
import Data.Time
import Imports

-- we really should be doing all this with https://hackage.haskell.org/package/units...
-- FUTUREWORK: we really should be doing all this with https://hackage.haskell.org/package/units...
millisecondsToDiffTime :: Integer -> DiffTime
millisecondsToDiffTime = picosecondsToDiffTime . (e9 *)

Expand Down
1 change: 0 additions & 1 deletion libs/galley-types/src/Galley/Types/Teams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ findTeamMember u = find ((u ==) . view userId)
isTeamOwner :: TeamMemberOptPerms -> Bool
isTeamOwner tm = optionalPermissions tm == Just fullPermissions

-- | Use this to construct the condition expected by 'teamMemberJson', 'teamMemberListJson'
canSeePermsOf :: TeamMember -> TeamMember -> Bool
canSeePermsOf seeer seeee =
seeer `hasPermission` GetMemberPermissions || seeer == seeee
10 changes: 0 additions & 10 deletions libs/hscim/src/Web/Scim/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module Web.Scim.Client
getUsers,
getUser,
postUser,
putUser,
patchUser,
deleteUser,

Expand Down Expand Up @@ -134,15 +133,6 @@ postUser ::
IO (StoredUser tag)
postUser env tok = case users (scimClients env) tok of ((_ :<|> (_ :<|> r)) :<|> (_ :<|> (_ :<|> _))) -> r

putUser ::
(HasScimClient tag) =>
ClientEnv ->
Maybe (AuthData tag) ->
UserId tag ->
User tag ->
IO (StoredUser tag)
putUser env tok = case users (scimClients env) tok of ((_ :<|> (_ :<|> _)) :<|> (r :<|> (_ :<|> _))) -> r

patchUser ::
(HasScimClient tag) =>
ClientEnv ->
Expand Down
24 changes: 0 additions & 24 deletions libs/imports/src/Imports.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,13 @@ module Imports
module UnliftIO.Directory,

-- ** Prelude
putChar,
putStr,
putStrLn,
print,
getChar,
getLine,
getContents,
interact,
readFile,
writeFile,
appendFile,
readIO,
readLn,

-- ** Environment
getArgs,
Expand Down Expand Up @@ -241,9 +235,6 @@ type LByteString = Data.ByteString.Lazy.ByteString
----------------------------------------------------------------------------
-- Lifted functions from Prelude

putChar :: (MonadIO m) => Char -> m ()
putChar = liftIO . P.putChar

putStr :: (MonadIO m) => String -> m ()
putStr = liftIO . P.putStr

Expand All @@ -253,18 +244,9 @@ putStrLn = liftIO . P.putStrLn
print :: (Show a, MonadIO m) => a -> m ()
print = liftIO . P.print

getChar :: (MonadIO m) => m Char
getChar = liftIO P.getChar

getLine :: (MonadIO m) => m String
getLine = liftIO P.getLine

getContents :: (MonadIO m) => m String
getContents = liftIO P.getContents

interact :: (MonadIO m) => (String -> String) -> m ()
interact = liftIO . P.interact

readFile :: (MonadIO m) => FilePath -> m String
readFile = liftIO . P.readFile

Expand All @@ -274,12 +256,6 @@ writeFile = fmap liftIO . P.writeFile
appendFile :: (MonadIO m) => FilePath -> String -> m ()
appendFile = fmap liftIO . P.appendFile

readIO :: (Read a, MonadIO m) => String -> m a
readIO = liftIO . P.readIO

readLn :: (Read a, MonadIO m) => m a
readLn = liftIO P.readLn

----------------------------------------------------------------------
-- Functor

Expand Down
7 changes: 2 additions & 5 deletions libs/wire-api/src/Wire/API/Team/Conversation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ newTeamConversation = TeamConversation
--------------------------------------------------------------------------------
-- TeamConversationList

newtype TeamConversationList = TeamConversationList
{ _teamConversations :: [TeamConversation]
}
newtype TeamConversationList = TeamConversationList {teamConversations :: [TeamConversation]}
deriving (Generic)
deriving stock (Eq, Show)
deriving newtype (Arbitrary)
Expand All @@ -91,10 +89,9 @@ instance ToSchema TeamConversationList where
"TeamConversationList"
(description ?~ "Team conversation list")
$ TeamConversationList
<$> _teamConversations .= field "conversations" (array schema)
<$> teamConversations .= field "conversations" (array schema)

newTeamConversationList :: [TeamConversation] -> TeamConversationList
newTeamConversationList = TeamConversationList

makeLenses ''TeamConversation
makeLenses ''TeamConversationList
9 changes: 0 additions & 9 deletions libs/wire-api/src/Wire/API/Team/Feature.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ module Wire.API.Team.Feature
setTTL,
setWsTTL,
WithStatusPatch,
wsPatch,
wspStatus,
wspLockStatus,
wspConfig,
Expand All @@ -53,7 +52,6 @@ module Wire.API.Team.Feature
FeatureTTL' (..),
FeatureTTLUnit (..),
convertFeatureTTLDaysToSeconds,
convertFeatureTTLSecondsToDays,
EnforceAppLock (..),
defFeatureStatusNoLock,
computeFeatureConfigForTeamUser,
Expand Down Expand Up @@ -319,9 +317,6 @@ deriving via (Schema (WithStatusPatch cfg)) instance (ToSchema (WithStatusPatch

deriving via (Schema (WithStatusPatch cfg)) instance (ToSchema (WithStatusPatch cfg), Typeable cfg) => S.ToSchema (WithStatusPatch cfg)

wsPatch :: Maybe FeatureStatus -> Maybe LockStatus -> Maybe cfg -> Maybe FeatureTTL -> WithStatusPatch cfg
wsPatch = WithStatusBase

wspStatus :: WithStatusPatch cfg -> Maybe FeatureStatus
wspStatus = wsbStatus

Expand Down Expand Up @@ -421,10 +416,6 @@ convertFeatureTTLDaysToSeconds :: FeatureTTLDays -> FeatureTTL
convertFeatureTTLDaysToSeconds FeatureTTLUnlimited = FeatureTTLUnlimited
convertFeatureTTLDaysToSeconds (FeatureTTLSeconds d) = FeatureTTLSeconds (d * (60 * 60 * 24))

convertFeatureTTLSecondsToDays :: FeatureTTL -> FeatureTTLDays
convertFeatureTTLSecondsToDays FeatureTTLUnlimited = FeatureTTLUnlimited
convertFeatureTTLSecondsToDays (FeatureTTLSeconds d) = FeatureTTLSeconds (d `div` (60 * 60 * 24))

instance Arbitrary FeatureTTL where
arbitrary =
(nonZero <$> arbitrary)
Expand Down
4 changes: 0 additions & 4 deletions libs/wire-api/src/Wire/API/Team/Member.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module Wire.API.Team.Member
invitation,
legalHoldStatus,
ntmNewTeamMember,
teamMemberJson,
setOptionalPerms,
setOptionalPermsMany,
teamMemberObjectSchema,
Expand Down Expand Up @@ -426,9 +425,6 @@ permissions = newTeamMember . nPermissions
invitation :: Lens' TeamMember (Maybe (UserId, UTCTimeMillis))
invitation = newTeamMember . nInvitation

teamMemberJson :: (TeamMember -> Bool) -> TeamMember -> Value
teamMemberJson withPerms = toJSON . setOptionalPerms withPerms

setOptionalPerms :: (TeamMember -> Bool) -> TeamMember -> TeamMember' 'Optional
setOptionalPerms withPerms m = m & permissions %~ setPerm (withPerms m)

Expand Down
6 changes: 0 additions & 6 deletions libs/wire-api/src/Wire/API/User.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ module Wire.API.User
urefToExternalIdUnsafe,
urefToEmail,
ExpiresIn,
newUserInvitationCode,
newUserTeam,
newUserEmail,
newUserSSOId,
Expand Down Expand Up @@ -1169,11 +1168,6 @@ instance Arbitrary NewUser where
genUserExpiresIn newUserIdentity =
if isJust newUserIdentity then pure Nothing else arbitrary

newUserInvitationCode :: NewUser -> Maybe InvitationCode
newUserInvitationCode nu = case newUserOrigin nu of
Just (NewUserOriginInvitationCode ic) -> Just ic
_ -> Nothing

newUserTeam :: NewUser -> Maybe NewTeamUser
newUserTeam nu = case newUserOrigin nu of
Just (NewUserOriginTeamUser tu) -> Just tu
Expand Down
4 changes: 0 additions & 4 deletions libs/wire-api/src/Wire/API/User/Auth.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
module Wire.API.User.Auth
( -- * Login
Login (..),
loginLabel,
LoginCode (..),
LoginId (..),
PendingLoginCode (..),
Expand Down Expand Up @@ -347,9 +346,6 @@ instance ToSchema Login where
<*> lLabel .= optField "label" (maybeWithDefault A.Null schema)
<*> lCode .= optField "verification_code" (maybeWithDefault A.Null schema)

loginLabel :: Login -> Maybe CookieLabel
loginLabel = lLabel

--------------------------------------------------------------------------------
-- RemoveCookies

Expand Down
4 changes: 0 additions & 4 deletions libs/wire-api/src/Wire/API/User/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ module Wire.API.User.Client
mkQualifiedUserClientPrekeyMap,
qualifiedUserClientPrekeyMapFromList,
UserClientsFull (..),
userClientsFullToUserClients,
UserClients (..),
mkUserClients,
QualifiedUserClients (..),
Expand Down Expand Up @@ -394,9 +393,6 @@ instance FromJSON UserClientsFull where
instance Arbitrary UserClientsFull where
arbitrary = UserClientsFull <$> mapOf' arbitrary (setOf' arbitrary)

userClientsFullToUserClients :: UserClientsFull -> UserClients
userClientsFullToUserClients (UserClientsFull mp) = UserClients $ Set.map clientId <$> mp

newtype UserClients = UserClients
{ userClients :: Map UserId (Set ClientId)
}
Expand Down
4 changes: 0 additions & 4 deletions libs/wire-api/src/Wire/API/User/Identity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ module Wire.API.User.Identity
-- * UserSSOId
UserSSOId (..),
emailFromSAML,
emailToSAML,
emailToSAMLNameID,
emailFromSAMLNameID,
mkSampleUref,
Expand Down Expand Up @@ -421,9 +420,6 @@ lenientlyParseSAMLNameID (Just txt) = do
emailFromSAML :: (HasCallStack) => SAMLEmail.Email -> Email
emailFromSAML = fromJust . parseEmail . SAMLEmail.render

emailToSAML :: (HasCallStack) => Email -> SAMLEmail.Email
emailToSAML = CI.original . fromRight (error "emailToSAML") . SAMLEmail.validate . toByteString

-- | FUTUREWORK(fisx): if saml2-web-sso exported the 'NameID' constructor, we could make this
-- function total without all that praying and hoping.
emailToSAMLNameID :: (HasCallStack) => Email -> SAML.NameID
Expand Down
6 changes: 1 addition & 5 deletions libs/wire-api/src/Wire/API/User/IdentityProvider.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,9 @@ instance Cql.Cql WireIdPAPIVersion where

-- | A list of 'IdP's, returned by some endpoints. Wrapped into an object to
-- allow extensibility later on.
data IdPList = IdPList
{ _providers :: [IdP]
}
newtype IdPList = IdPList {providers :: [IdP]}
deriving (Eq, Show, Generic)

makeLenses ''IdPList

-- Same as WireIdP, we want the lenses, so we have to drop a prefix
deriveJSON (defaultOptsDropChar '_') ''IdPList

Expand Down
3 changes: 0 additions & 3 deletions libs/wire-api/src/Wire/API/User/Saml.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
-- for them.
module Wire.API.User.Saml where

import Control.Lens (makeLenses)
import Control.Monad.Except
import Data.Aeson hiding (fieldLabelModifier)
import Data.Aeson.TH hiding (fieldLabelModifier)
Expand Down Expand Up @@ -62,8 +61,6 @@ data VerdictFormat
| VerdictFormatMobile {_formatGrantedURI :: URI, _formatDeniedURI :: URI}
deriving (Eq, Show, Generic)

makeLenses ''VerdictFormat

deriveJSON deriveJSONOptions ''VerdictFormat

mkVerdictGrantedFormatMobile :: (MonadError String m) => URI -> SetCookie -> UserId -> m URI
Expand Down
7 changes: 0 additions & 7 deletions libs/wire-api/src/Wire/API/User/Scim.hs
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,6 @@ veidUref = prism' UrefOnly $
UrefOnly uref -> Just uref
EmailOnly _ -> Nothing

veidEmail :: Prism' ValidExternalId Email
veidEmail = prism' EmailOnly $
\case
EmailAndUref em _ -> Just em
UrefOnly _ -> Nothing
EmailOnly em -> Just em

makeLenses ''ValidScimUser
makeLenses ''ValidExternalId

Expand Down
5 changes: 1 addition & 4 deletions libs/wire-api/src/Wire/API/User/Search.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}

-- This file is part of the Wire Server implementation.
--
Expand Down Expand Up @@ -35,7 +34,7 @@ where

import Cassandra qualified as C
import Control.Error
import Control.Lens (makePrisms, (?~))
import Control.Lens ((?~))
import Data.Aeson hiding (object, (.=))
import Data.Aeson qualified as Aeson
import Data.Attoparsec.ByteString (sepBy)
Expand Down Expand Up @@ -329,5 +328,3 @@ instance C.Cql FederatedUserSearchPolicy where
fromCql (C.CqlInt 1) = pure ExactHandleSearch
fromCql (C.CqlInt 2) = pure FullSearch
fromCql n = Left $ "Unexpected SearchVisibilityInbound: " ++ show n

makePrisms ''FederatedUserSearchPolicy
Loading