wire-subsystems-0.1.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Wire.UserSubsystem

Synopsis

Documentation

data UserSubsystem m a where Source #

Constructors

GetUserProfiles :: Local UserId -> [Qualified UserId] -> UserSubsystem m [UserProfile]

First arg is for authorization only.

GetUserProfilesWithErrors :: Local UserId -> [Qualified UserId] -> UserSubsystem m ([(Qualified UserId, FederationError)], [UserProfile])

These give us partial success and hide concurrency in the interpreter. (Nit-pick: a better return type for this might be `([Qualified ([UserId], FederationError)], [UserProfile])`, and then we'd probably need a function of type `([Qualified ([UserId], FederationError)], [UserProfile]) -> ([(Qualified UserId, FederationError)], [UserProfile])` to maintain API compatibility.)

GetLocalUserProfiles :: Local [UserId] -> UserSubsystem m [UserProfile]

Sometimes we don't have any identity of a requesting user, and local profiles are public.

GetAccountsBy :: Local GetBy -> UserSubsystem m [User]

Get the union of all user accounts matching the GetBy argument *and* having a non-empty UserIdentity.

GetAccountsByEmailNoFilter :: Local [EmailAddress] -> UserSubsystem m [User]

Get user accounts matching the `[EmailAddress]` argument (accounts with missing identity and accounts with status /= active included).

GetAccountNoFilter :: Local UserId -> UserSubsystem m (Maybe User)

Get user account by local user id (accounts with missing identity and accounts with status /= active included).

GetSelfProfile :: Local UserId -> UserSubsystem m (Maybe SelfProfile)

Get SelfProfile (it contains things not present in UserProfile).

UpdateUserProfile :: Local UserId -> Maybe ConnId -> UpdateOriginType -> UserProfileUpdate -> UserSubsystem m ()

Simple updates (as opposed to, eg., handle, where we need to manage locks). Empty fields are ignored (not deleted).

CheckHandle :: Text -> UserSubsystem m CheckHandleResp

Parse and lookup a handle.

CheckHandles :: [Handle] -> Word -> UserSubsystem m [Handle]

Check a number of Handles for availability and returns at most Word amount of them

UpdateHandle :: Local UserId -> Maybe ConnId -> UpdateOriginType -> Text -> UserSubsystem m ()

Parse and update a handle. Parsing may fail so this is effectful.

LookupLocaleWithDefault :: Local UserId -> UserSubsystem m (Maybe Locale)

Return the user's locale (or the default locale if the users exists and has none).

IsBlocked :: EmailAddress -> UserSubsystem m Bool

Check if an email is blocked.

BlockListDelete :: EmailAddress -> UserSubsystem m ()

Remove an email from the block list.

BlockListInsert :: EmailAddress -> UserSubsystem m ()

Add an email to the block list.

UpdateTeamSearchVisibilityInbound :: TeamStatus SearchVisibilityInboundConfig -> UserSubsystem m () 
SearchUsers :: Local UserId -> Text -> Maybe Domain -> Maybe (Range 1 500 Int32) -> UserSubsystem m (SearchResult Contact) 
BrowseTeam :: UserId -> BrowseTeamFilters -> Maybe (Range 1 500 Int) -> Maybe PagingState -> UserSubsystem m (SearchResult TeamContact) 
AcceptTeamInvitation :: Local UserId -> PlainTextPassword6 -> InvitationCode -> UserSubsystem m ()

(... or does AcceptTeamInvitation belong into TeamInvitationSubsystems?)

InternalUpdateSearchIndex :: UserId -> UserSubsystem m ()

The following "internal" functions exists to support migration in this susbystem, after the migration this would just be an internal detail of the subsystem

InternalFindTeamInvitation :: Maybe EmailKey -> InvitationCode -> UserSubsystem m StoredInvitation 
GetUserExportData :: UserId -> UserSubsystem m (Maybe TeamExportUser) 

data UserProfileUpdate Source #

Simple updates (as opposed to, eg., handle, where we need to manage locks).

This is isomorphic to StoredUserUpdate, but we keep the two types separate because they belong to different abstraction levels (UserSubsystem vs. UserStore), and they may change independently in the future (UserStoreUpdate may grow more fields for other operations).

Instances

Instances details
Arbitrary UserProfileUpdate Source # 
Instance details

Defined in Wire.UserSubsystem

Generic UserProfileUpdate Source # 
Instance details

Defined in Wire.UserSubsystem

Associated Types

type Rep UserProfileUpdate :: Type -> Type #

Show UserProfileUpdate Source # 
Instance details

Defined in Wire.UserSubsystem

Default UserProfileUpdate Source # 
Instance details

Defined in Wire.UserSubsystem

Eq UserProfileUpdate Source # 
Instance details

Defined in Wire.UserSubsystem

Ord UserProfileUpdate Source # 
Instance details

Defined in Wire.UserSubsystem

type Rep UserProfileUpdate Source # 
Instance details

Defined in Wire.UserSubsystem

data UpdateOriginType Source #

Who is performing this update operation / who is allowed to? (Single source of truth: users managed by SCIM can't be updated by clients and vice versa.)

Constructors

UpdateOriginScim

Call originates from the SCIM api in spar.

UpdateOriginWireClient

Call originates from wire client (mobile, web, or team-management).

Instances

Instances details
Arbitrary UpdateOriginType Source # 
Instance details

Defined in Wire.UserSubsystem

Generic UpdateOriginType Source # 
Instance details

Defined in Wire.UserSubsystem

Associated Types

type Rep UpdateOriginType :: Type -> Type #

Show UpdateOriginType Source # 
Instance details

Defined in Wire.UserSubsystem

Eq UpdateOriginType Source # 
Instance details

Defined in Wire.UserSubsystem

Ord UpdateOriginType Source # 
Instance details

Defined in Wire.UserSubsystem

type Rep UpdateOriginType Source # 
Instance details

Defined in Wire.UserSubsystem

type Rep UpdateOriginType = D1 ('MetaData "UpdateOriginType" "Wire.UserSubsystem" "wire-subsystems-0.1.0-8kLXA8DL8T7Joz69IIRPwJ" 'False) (C1 ('MetaCons "UpdateOriginScim" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "UpdateOriginWireClient" 'PrefixI 'False) (U1 :: Type -> Type))

data GetBy Source #

Parameters for getExternalAccountsBy operation below.

Constructors

MkGetBy 

Fields

Instances

Instances details
Arbitrary GetBy Source # 
Instance details

Defined in Wire.UserSubsystem

Generic GetBy Source # 
Instance details

Defined in Wire.UserSubsystem

Associated Types

type Rep GetBy :: Type -> Type #

Methods

from :: GetBy -> Rep GetBy x #

to :: Rep GetBy x -> GetBy #

Show GetBy Source # 
Instance details

Defined in Wire.UserSubsystem

Methods

showsPrec :: Int -> GetBy -> ShowS #

show :: GetBy -> String #

showList :: [GetBy] -> ShowS #

Default GetBy Source # 
Instance details

Defined in Wire.UserSubsystem

Methods

def :: GetBy Source #

Eq GetBy Source # 
Instance details

Defined in Wire.UserSubsystem

Methods

(==) :: GetBy -> GetBy -> Bool #

(/=) :: GetBy -> GetBy -> Bool #

Ord GetBy Source # 
Instance details

Defined in Wire.UserSubsystem

Methods

compare :: GetBy -> GetBy -> Ordering #

(<) :: GetBy -> GetBy -> Bool #

(<=) :: GetBy -> GetBy -> Bool #

(>) :: GetBy -> GetBy -> Bool #

(>=) :: GetBy -> GetBy -> Bool #

max :: GetBy -> GetBy -> GetBy #

min :: GetBy -> GetBy -> GetBy #

type Rep GetBy Source # 
Instance details

Defined in Wire.UserSubsystem

type Rep GetBy = D1 ('MetaData "GetBy" "Wire.UserSubsystem" "wire-subsystems-0.1.0-8kLXA8DL8T7Joz69IIRPwJ" 'False) (C1 ('MetaCons "MkGetBy" 'PrefixI 'True) (S1 ('MetaSel ('Just "includePendingInvitations") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HavePendingInvitations) :*: (S1 ('MetaSel ('Just "getByUserId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [UserId]) :*: S1 ('MetaSel ('Just "getByHandle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Handle]))))

getSelfProfile :: forall r. Member UserSubsystem r => Local UserId -> Sem r (Maybe SelfProfile) Source #

Get SelfProfile (it contains things not present in UserProfile).

isBlocked :: forall r. Member UserSubsystem r => EmailAddress -> Sem r Bool Source #

Check if an email is blocked.

updateHandle :: forall r. Member UserSubsystem r => Local UserId -> Maybe ConnId -> UpdateOriginType -> Text -> Sem r () Source #

Parse and update a handle. Parsing may fail so this is effectful.

getUserProfiles :: forall r. Member UserSubsystem r => Local UserId -> [Qualified UserId] -> Sem r [UserProfile] Source #

First arg is for authorization only.

getLocalUserProfiles :: forall r. Member UserSubsystem r => Local [UserId] -> Sem r [UserProfile] Source #

Sometimes we don't have any identity of a requesting user, and local profiles are public.

getAccountsBy :: forall r. Member UserSubsystem r => Local GetBy -> Sem r [User] Source #

Get the union of all user accounts matching the GetBy argument *and* having a non-empty UserIdentity.

getAccountsByEmailNoFilter :: forall r. Member UserSubsystem r => Local [EmailAddress] -> Sem r [User] Source #

Get user accounts matching the `[EmailAddress]` argument (accounts with missing identity and accounts with status /= active included).

getUserProfilesWithErrors :: forall r. Member UserSubsystem r => Local UserId -> [Qualified UserId] -> Sem r ([(Qualified UserId, FederationError)], [UserProfile]) Source #

These give us partial success and hide concurrency in the interpreter. (Nit-pick: a better return type for this might be `([Qualified ([UserId], FederationError)], [UserProfile])`, and then we'd probably need a function of type `([Qualified ([UserId], FederationError)], [UserProfile]) -> ([(Qualified UserId, FederationError)], [UserProfile])` to maintain API compatibility.)

getAccountNoFilter :: forall r. Member UserSubsystem r => Local UserId -> Sem r (Maybe User) Source #

Get user account by local user id (accounts with missing identity and accounts with status /= active included).

updateUserProfile :: forall r. Member UserSubsystem r => Local UserId -> Maybe ConnId -> UpdateOriginType -> UserProfileUpdate -> Sem r () Source #

Simple updates (as opposed to, eg., handle, where we need to manage locks). Empty fields are ignored (not deleted).

checkHandle :: forall r. Member UserSubsystem r => Text -> Sem r CheckHandleResp Source #

Parse and lookup a handle.

checkHandles :: forall r. Member UserSubsystem r => [Handle] -> Word -> Sem r [Handle] Source #

Check a number of Handles for availability and returns at most Word amount of them

lookupLocaleWithDefault :: forall r. Member UserSubsystem r => Local UserId -> Sem r (Maybe Locale) Source #

Return the user's locale (or the default locale if the users exists and has none).

blockListDelete :: forall r. Member UserSubsystem r => EmailAddress -> Sem r () Source #

Remove an email from the block list.

blockListInsert :: forall r. Member UserSubsystem r => EmailAddress -> Sem r () Source #

Add an email to the block list.

acceptTeamInvitation :: forall r. Member UserSubsystem r => Local UserId -> PlainTextPassword6 -> InvitationCode -> Sem r () Source #

(... or does AcceptTeamInvitation belong into TeamInvitationSubsystems?)

internalUpdateSearchIndex :: forall r. Member UserSubsystem r => UserId -> Sem r () Source #

The following "internal" functions exists to support migration in this susbystem, after the migration this would just be an internal detail of the subsystem