"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "services/galley/src/Galley/API/Teams.hs" between
wire-server-2020-06-10.tar.gz and wire-server-2020-06-19.tar.gz

About: Wire (server) offers end-to-end encrypted messaging, file-sharing, video and voice calls, and guest rooms for external communication (back-end server).

Teams.hs  (wire-server-2020-06-10):Teams.hs  (wire-server-2020-06-19)
skipping to change at line 65 skipping to change at line 65
canUserJoinTeamH, canUserJoinTeamH,
internalDeleteBindingTeamWithOneMemberH, internalDeleteBindingTeamWithOneMemberH,
internalDeleteBindingTeamWithOneMember, internalDeleteBindingTeamWithOneMember,
) )
where where
import Brig.Types.Team (TeamSize (..)) import Brig.Types.Team (TeamSize (..))
import Control.Lens import Control.Lens
import Control.Monad.Catch import Control.Monad.Catch
import Data.ByteString.Conversion hiding (fromList) import Data.ByteString.Conversion hiding (fromList)
import qualified Data.Id as Id
import Data.Id import Data.Id
import Data.IdMapping (MappedOrLocalId (Local))
import qualified Data.List.Extra as List import qualified Data.List.Extra as List
import Data.List1 (list1) import Data.List1 (list1)
import Data.Range as Range import Data.Range as Range
import Data.Set (fromList) import Data.Set (fromList)
import qualified Data.Set as Set import qualified Data.Set as Set
import Data.Time.Clock (UTCTime (..), getCurrentTime) import Data.Time.Clock (UTCTime (..), getCurrentTime)
import qualified Data.UUID as UUID import qualified Data.UUID as UUID
import qualified Data.UUID.Util as UUID import qualified Data.UUID.Util as UUID
import Galley.API.Error as Galley import Galley.API.Error as Galley
import Galley.API.LegalHold import Galley.API.LegalHold
skipping to change at line 244 skipping to change at line 246
zusrMembership <- Data.teamMember tid zusr zusrMembership <- Data.teamMember tid zusr
-- let zothers = map (view userId) membs -- let zothers = map (view userId) membs
-- Log.debug $ -- Log.debug $
-- Log.field "targets" (toByteString . show $ toByteString <$> zothers) -- Log.field "targets" (toByteString . show $ toByteString <$> zothers)
-- . Log.field "action" (Log.val "Teams.updateTeam") -- . Log.field "action" (Log.val "Teams.updateTeam")
void $ permissionCheck SetTeamData zusrMembership void $ permissionCheck SetTeamData zusrMembership
Data.updateTeam tid updateData Data.updateTeam tid updateData
now <- liftIO getCurrentTime now <- liftIO getCurrentTime
memList <- Data.teamMembersForFanout tid memList <- Data.teamMembersForFanout tid
let e = newEvent TeamUpdate tid now & eventData .~ Just (EdTeamUpdate updateDa ta) let e = newEvent TeamUpdate tid now & eventData .~ Just (EdTeamUpdate updateDa ta)
let r = list1 (userRecipient zusr) (membersToRecipients (Just zusr) (memList ^ . teamMembers)) let r = list1 (userRecipient (Local zusr)) (membersToRecipients (Just zusr) (m emList ^. teamMembers))
push1 $ newPush1 (memList ^. teamMemberListType) zusr (TeamEvent e) r & pushCo nn .~ Just zcon push1 $ newPush1 (memList ^. teamMemberListType) zusr (TeamEvent e) r & pushCo nn .~ Just zcon
deleteTeamH :: UserId ::: ConnId ::: TeamId ::: OptionalJsonRequest Public.TeamD eleteData ::: JSON -> Galley Response deleteTeamH :: UserId ::: ConnId ::: TeamId ::: OptionalJsonRequest Public.TeamD eleteData ::: JSON -> Galley Response
deleteTeamH (zusr ::: zcon ::: tid ::: req ::: _) = do deleteTeamH (zusr ::: zcon ::: tid ::: req ::: _) = do
mBody <- fromOptionalJsonBody req mBody <- fromOptionalJsonBody req
deleteTeam zusr zcon tid mBody deleteTeam zusr zcon tid mBody
pure (empty & setStatus status202) pure (empty & setStatus status202)
-- | 'TeamDeleteData' is only required for binding teams -- | 'TeamDeleteData' is only required for binding teams
deleteTeam :: UserId -> ConnId -> TeamId -> Maybe Public.TeamDeleteData -> Galle y () deleteTeam :: UserId -> ConnId -> TeamId -> Maybe Public.TeamDeleteData -> Galle y ()
skipping to change at line 312 skipping to change at line 314
-- every bot user can only be in a single conversation. Just -- every bot user can only be in a single conversation. Just
-- deleting conversations from the database is not enough. -- deleting conversations from the database is not enough.
when ((view teamBinding . tdTeam <$> team) == Just Binding) $ do when ((view teamBinding . tdTeam <$> team) == Just Binding) $ do
mapM_ (deleteUser . view userId) membs mapM_ (deleteUser . view userId) membs
Journal.teamDelete tid Journal.teamDelete tid
Data.deleteTeam tid Data.deleteTeam tid
where where
pushDeleteEvents :: [TeamMember] -> Event -> [Push] -> Galley () pushDeleteEvents :: [TeamMember] -> Event -> [Push] -> Galley ()
pushDeleteEvents membs e ue = do pushDeleteEvents membs e ue = do
o <- view $ options . optSettings o <- view $ options . optSettings
let r = list1 (userRecipient zusr) (membersToRecipients (Just zusr) membs) let r = list1 (userRecipient (Local zusr)) (membersToRecipients (Just zusr ) membs)
-- To avoid DoS on gundeck, send team deletion events in chunks -- To avoid DoS on gundeck, send team deletion events in chunks
let chunkSize = fromMaybe defConcurrentDeletionEvents (o ^. setConcurrentD eletionEvents) let chunkSize = fromMaybe defConcurrentDeletionEvents (o ^. setConcurrentD eletionEvents)
let chunks = List.chunksOf chunkSize (toList r) let chunks = List.chunksOf chunkSize (toList r)
forM_ chunks $ \chunk -> case chunk of forM_ chunks $ \chunk -> case chunk of
[] -> return () [] -> return ()
-- push TeamDelete events. Note that despite having a complete list, we are guaranteed in the -- push TeamDelete events. Note that despite having a complete list, we are guaranteed in the
-- push module to never fan this out to more than the limit -- push module to never fan this out to more than the limit
x : xs -> push1 (newPush1 ListComplete zusr (TeamEvent e) (list1 x xs) & pushConn .~ zcon) x : xs -> push1 (newPush1 ListComplete zusr (TeamEvent e) (list1 x xs) & pushConn .~ zcon)
-- To avoid DoS on gundeck, send conversation deletion events slowly -- To avoid DoS on gundeck, send conversation deletion events slowly
let delay = 1000 * (fromMaybe defDeleteConvThrottleMillis (o ^. setDeleteC onvThrottleMillis)) let delay = 1000 * (fromMaybe defDeleteConvThrottleMillis (o ^. setDeleteC onvThrottleMillis))
skipping to change at line 334 skipping to change at line 336
-- push ConversationDelete events -- push ConversationDelete events
push1 event push1 event
threadDelay delay threadDelay delay
createConvDeleteEvents :: createConvDeleteEvents ::
UTCTime -> UTCTime ->
[TeamMember] -> [TeamMember] ->
TeamConversation -> TeamConversation ->
([Push], [(BotMember, Conv.Event)]) -> ([Push], [(BotMember, Conv.Event)]) ->
Galley ([Push], [(BotMember, Conv.Event)]) Galley ([Push], [(BotMember, Conv.Event)])
createConvDeleteEvents now teamMembs c (pp, ee) = do createConvDeleteEvents now teamMembs c (pp, ee) = do
(bots, convMembs) <- botsAndUsers <$> Data.members (c ^. conversationId) (bots, convMembs) <- botsAndUsers =<< Data.members (c ^. conversationId)
-- Only nonTeamMembers need to get any events, since on team deletion, -- Only nonTeamMembers need to get any events, since on team deletion,
-- all team users are deleted immediately after these events are sent -- all team users are deleted immediately after these events are sent
-- and will thus never be able to see these events in practice. -- and will thus never be able to see these events in practice.
let mm = nonTeamMembers convMembs teamMembs let mm = nonTeamMembers convMembs teamMembs
let e = Conv.Event Conv.ConvDelete (c ^. conversationId) zusr now Nothing let e = Conv.Event Conv.ConvDelete (c ^. conversationId) zusr now Nothing
-- This event always contains all the required recipients -- This event always contains all the required recipients
let p = newPush ListComplete zusr (ConvEvent e) (map recipient mm) let p = newPush ListComplete zusr (ConvEvent e) (map recipient mm)
let ee' = bots `zip` repeat e let ee' = bots `zip` repeat e
let pp' = maybe pp (\x -> (x & pushConn .~ zcon) : pp) p let pp' = maybe pp (\x -> (x & pushConn .~ zcon) : pp) p
pure (pp', ee' ++ ee) pure (pp', ee' ++ ee)
skipping to change at line 599 skipping to change at line 601
uncheckedDeleteTeamMember zusr zcon tid remove mems = do uncheckedDeleteTeamMember zusr zcon tid remove mems = do
now <- liftIO getCurrentTime now <- liftIO getCurrentTime
pushMemberLeaveEvent now pushMemberLeaveEvent now
Data.removeTeamMember tid remove Data.removeTeamMember tid remove
removeFromConvsAndPushConvLeaveEvent now removeFromConvsAndPushConvLeaveEvent now
where where
-- notify all team members. -- notify all team members.
pushMemberLeaveEvent :: UTCTime -> Galley () pushMemberLeaveEvent :: UTCTime -> Galley ()
pushMemberLeaveEvent now = do pushMemberLeaveEvent now = do
let e = newEvent MemberLeave tid now & eventData .~ Just (EdMemberLeave re move) let e = newEvent MemberLeave tid now & eventData .~ Just (EdMemberLeave re move)
let r = list1 (userRecipient zusr) (membersToRecipients (Just zusr) (mems ^. teamMembers)) let r = list1 (userRecipient (Local zusr)) (membersToRecipients (Just zusr ) (mems ^. teamMembers))
push1 $ newPush1 (mems ^. teamMemberListType) zusr (TeamEvent e) r & pushC onn .~ zcon push1 $ newPush1 (mems ^. teamMemberListType) zusr (TeamEvent e) r & pushC onn .~ zcon
-- notify all conversation members not in this team. -- notify all conversation members not in this team.
removeFromConvsAndPushConvLeaveEvent :: UTCTime -> Galley () removeFromConvsAndPushConvLeaveEvent :: UTCTime -> Galley ()
removeFromConvsAndPushConvLeaveEvent now = do removeFromConvsAndPushConvLeaveEvent now = do
-- This may not make sense if that list has been truncated. In such cases, we still want to -- This may not make sense if that list has been truncated. In such cases, we still want to
-- remove the user from conversations but never send out any events. We as sume that clients -- remove the user from conversations but never send out any events. We as sume that clients
-- handle nicely these missing events, regardless of whether they are in t he same team or not -- handle nicely these missing events, regardless of whether they are in t he same team or not
let tmids = Set.fromList $ map (view userId) (mems ^. teamMembers) let tmids = Set.fromList $ map (Local . view userId) (mems ^. teamMembers)
let edata = Conv.EdMembersLeave (Conv.UserIdList [remove]) let edata = Conv.EdMembersLeave (Conv.UserIdList [remove])
cc <- Data.teamConversations tid cc <- Data.teamConversations tid
for_ cc $ \c -> Data.conversation (c ^. conversationId) >>= \conv -> for_ cc $ \c -> Data.conversation (c ^. conversationId) >>= \conv ->
for_ conv $ \dc -> when (makeIdOpaque remove `isMember` Data.convMembers for_ conv $ \dc -> when (Local remove `isMember` Data.convMembers dc) $
dc) $ do do
Data.removeMember remove (c ^. conversationId) Data.removeMember (Local remove) (c ^. conversationId)
-- If the list was truncated, then the tmids list is incomplete so we simply drop these events -- If the list was truncated, then the tmids list is incomplete so we simply drop these events
unless (c ^. managedConversation || mems ^. teamMemberListType == List Truncated) $ unless (c ^. managedConversation || mems ^. teamMemberListType == List Truncated) $
pushEvent tmids edata now dc pushEvent tmids edata now dc
pushEvent :: Set UserId -> Conv.EventData -> UTCTime -> Data.Conversation -> Galley () pushEvent :: Set (MappedOrLocalId Id.U) -> Conv.EventData -> UTCTime -> Data .Conversation -> Galley ()
pushEvent exceptTo edata now dc = do pushEvent exceptTo edata now dc = do
let (bots, users) = botsAndUsers (Data.convMembers dc) (bots, users) <- botsAndUsers (Data.convMembers dc)
let x = filter (\m -> not (Conv.memId m `Set.member` exceptTo)) users let x = filter (\m -> not (Conv.memId m `Set.member` exceptTo)) users
let y = Conv.Event Conv.MemberLeave (Data.convId dc) zusr now (Just edata) let y = Conv.Event Conv.MemberLeave (Data.convId dc) zusr now (Just edata)
for_ (newPush (mems ^. teamMemberListType) zusr (ConvEvent y) (recipient < $> x)) $ \p -> for_ (newPush (mems ^. teamMemberListType) zusr (ConvEvent y) (recipient < $> x)) $ \p ->
push1 $ p & pushConn .~ zcon push1 $ p & pushConn .~ zcon
void . forkIO $ void $ External.deliver (bots `zip` repeat y) void . forkIO $ void $ External.deliver (bots `zip` repeat y)
getTeamConversationsH :: UserId ::: TeamId ::: JSON -> Galley Response getTeamConversationsH :: UserId ::: TeamId ::: JSON -> Galley Response
getTeamConversationsH (zusr ::: tid ::: _) = do getTeamConversationsH (zusr ::: tid ::: _) = do
json <$> getTeamConversations zusr tid json <$> getTeamConversations zusr tid
skipping to change at line 654 skipping to change at line 656
throwM (operationDenied GetTeamConversations) throwM (operationDenied GetTeamConversations)
Data.teamConversation tid cid >>= maybe (throwM convNotFound) pure Data.teamConversation tid cid >>= maybe (throwM convNotFound) pure
deleteTeamConversationH :: UserId ::: ConnId ::: TeamId ::: ConvId ::: JSON -> G alley Response deleteTeamConversationH :: UserId ::: ConnId ::: TeamId ::: ConvId ::: JSON -> G alley Response
deleteTeamConversationH (zusr ::: zcon ::: tid ::: cid ::: _) = do deleteTeamConversationH (zusr ::: zcon ::: tid ::: cid ::: _) = do
deleteTeamConversation zusr zcon tid cid deleteTeamConversation zusr zcon tid cid
pure empty pure empty
deleteTeamConversation :: UserId -> ConnId -> TeamId -> ConvId -> Galley () deleteTeamConversation :: UserId -> ConnId -> TeamId -> ConvId -> Galley ()
deleteTeamConversation zusr zcon tid cid = do deleteTeamConversation zusr zcon tid cid = do
(bots, cmems) <- botsAndUsers <$> Data.members cid (bots, cmems) <- botsAndUsers =<< Data.members cid
ensureActionAllowed Roles.DeleteConversation =<< getSelfMember zusr cmems ensureActionAllowed Roles.DeleteConversation =<< getSelfMember zusr cmems
flip Data.deleteCode Data.ReusableCode =<< Data.mkKey cid flip Data.deleteCode Data.ReusableCode =<< Data.mkKey cid
now <- liftIO getCurrentTime now <- liftIO getCurrentTime
let ce = Conv.Event Conv.ConvDelete cid zusr now Nothing let ce = Conv.Event Conv.ConvDelete cid zusr now Nothing
let recps = fmap recipient cmems let recps = fmap recipient cmems
let convPush = newPush ListComplete zusr (ConvEvent ce) recps <&> pushConn .~ Just zcon let convPush = newPush ListComplete zusr (ConvEvent ce) recps <&> pushConn .~ Just zcon
pushSome $ maybeToList convPush pushSome $ maybeToList convPush
void . forkIO $ void $ External.deliver (bots `zip` repeat ce) void . forkIO $ void $ External.deliver (bots `zip` repeat ce)
-- TODO: we don't delete bots here, but we should do that, since every -- TODO: we don't delete bots here, but we should do that, since every
-- bot user can only be in a single conversation -- bot user can only be in a single conversation
skipping to change at line 772 skipping to change at line 774
Data.addTeamMember tid new Data.addTeamMember tid new
cc <- filter (view managedConversation) <$> Data.teamConversations tid cc <- filter (view managedConversation) <$> Data.teamConversations tid
now <- liftIO getCurrentTime now <- liftIO getCurrentTime
for_ cc $ \c -> for_ cc $ \c ->
Data.addMember now (c ^. conversationId) (new ^. userId) Data.addMember now (c ^. conversationId) (new ^. userId)
let e = newEvent MemberJoin tid now & eventData ?~ EdMemberJoin (new ^. userId ) let e = newEvent MemberJoin tid now & eventData ?~ EdMemberJoin (new ^. userId )
push1 $ newPush1 (memList ^. teamMemberListType) (new ^. userId) (TeamEvent e) (recipients origin new) & pushConn .~ originConn push1 $ newPush1 (memList ^. teamMemberListType) (new ^. userId) (TeamEvent e) (recipients origin new) & pushConn .~ originConn
APITeamQueue.pushTeamEvent tid e APITeamQueue.pushTeamEvent tid e
return sizeBeforeAdd return sizeBeforeAdd
where where
recipients (Just o) n = list1 (userRecipient o) (membersToRecipients (Just o recipients (Just o) n =
) (n : memList ^. teamMembers)) list1
recipients Nothing n = list1 (userRecipient (n ^. userId)) (membersToRecipie (userRecipient (Local o))
nts Nothing (memList ^. teamMembers)) (membersToRecipients (Just o) (n : memList ^. teamMembers))
recipients Nothing n =
list1
(userRecipient (Local (n ^. userId)))
(membersToRecipients Nothing (memList ^. teamMembers))
-- | See also: 'Gundeck.API.Public.paginateH', but the semantics of this end-poi nt is slightly -- | See also: 'Gundeck.API.Public.paginateH', but the semantics of this end-poi nt is slightly
-- less warped. This is a work-around because we cannot send events to all of a large team. -- less warped. This is a work-around because we cannot send events to all of a large team.
-- See haddocks of module "Galley.API.TeamNotifications" for details. -- See haddocks of module "Galley.API.TeamNotifications" for details.
getTeamNotificationsH :: getTeamNotificationsH ::
UserId UserId
::: Maybe ByteString {- NotificationId -} ::: Maybe ByteString {- NotificationId -}
::: Range 1 10000 Int32 ::: Range 1 10000 Int32
::: JSON -> ::: JSON ->
Galley Response Galley Response
skipping to change at line 810 skipping to change at line 818
isV1UUID u = if UUID.version u == 1 then Just u else Nothing isV1UUID u = if UUID.version u == 1 then Just u else Nothing
finishCreateTeam :: Team -> TeamMember -> [TeamMember] -> Maybe ConnId -> Galley () finishCreateTeam :: Team -> TeamMember -> [TeamMember] -> Maybe ConnId -> Galley ()
finishCreateTeam team owner others zcon = do finishCreateTeam team owner others zcon = do
let zusr = owner ^. userId let zusr = owner ^. userId
for_ (owner : others) $ for_ (owner : others) $
Data.addTeamMember (team ^. teamId) Data.addTeamMember (team ^. teamId)
now <- liftIO getCurrentTime now <- liftIO getCurrentTime
let e = newEvent TeamCreate (team ^. teamId) now & eventData ?~ EdTeamCreate t eam let e = newEvent TeamCreate (team ^. teamId) now & eventData ?~ EdTeamCreate t eam
let r = membersToRecipients Nothing others let r = membersToRecipients Nothing others
push1 $ newPush1 ListComplete zusr (TeamEvent e) (list1 (userRecipient zusr) r ) & pushConn .~ zcon push1 $ newPush1 ListComplete zusr (TeamEvent e) (list1 (userRecipient (Local zusr)) r) & pushConn .~ zcon
withBindingTeam :: UserId -> (TeamId -> Galley b) -> Galley b withBindingTeam :: UserId -> (TeamId -> Galley b) -> Galley b
withBindingTeam zusr callback = do withBindingTeam zusr callback = do
tid <- Data.oneUserTeam zusr >>= ifNothing teamNotFound tid <- Data.oneUserTeam zusr >>= ifNothing teamNotFound
binding <- Data.teamBinding tid >>= ifNothing teamNotFound binding <- Data.teamBinding tid >>= ifNothing teamNotFound
case binding of case binding of
Binding -> callback tid Binding -> callback tid
NonBinding -> throwM nonBindingTeam NonBinding -> throwM nonBindingTeam
getBindingTeamIdH :: UserId -> Galley Response getBindingTeamIdH :: UserId -> Galley Response
skipping to change at line 875 skipping to change at line 883
getFeatureStatusInternalH (tid ::: featureName ::: _) = do getFeatureStatusInternalH (tid ::: featureName ::: _) = do
json <$> getFeatureStatusInternal tid featureName json <$> getFeatureStatusInternal tid featureName
getFeatureStatusInternal :: TeamId -> Public.TeamFeatureName -> Galley Public.Te amFeatureStatus getFeatureStatusInternal :: TeamId -> Public.TeamFeatureName -> Galley Public.Te amFeatureStatus
getFeatureStatusInternal tid featureName = do getFeatureStatusInternal tid featureName = do
case featureName of case featureName of
Public.TeamFeatureLegalHold -> getLegalholdStatusInternal tid Public.TeamFeatureLegalHold -> getLegalholdStatusInternal tid
Public.TeamFeatureSSO -> getSSOStatusInternal tid Public.TeamFeatureSSO -> getSSOStatusInternal tid
Public.TeamFeatureSearchVisibility -> getTeamSearchVisibilityAvailableIntern al tid Public.TeamFeatureSearchVisibility -> getTeamSearchVisibilityAvailableIntern al tid
Public.TeamFeatureValidateSAMLEmails -> getValidateSAMLEmailsInternal tid Public.TeamFeatureValidateSAMLEmails -> getValidateSAMLEmailsInternal tid
Public.TeamFeatureDigitalSignatures -> getDigitalSignaturesInternal tid
-- | Enable or disable feature flag for a team. To be called only from authoriz ed personnel -- | Enable or disable feature flag for a team. To be called only from authoriz ed personnel
-- (e.g., from a backoffice tool) -- (e.g., from a backoffice tool)
setFeatureStatusInternalH :: TeamId ::: Public.TeamFeatureName ::: JsonRequest P ublic.TeamFeatureStatus ::: JSON -> Galley Response setFeatureStatusInternalH :: TeamId ::: Public.TeamFeatureName ::: JsonRequest P ublic.TeamFeatureStatus ::: JSON -> Galley Response
setFeatureStatusInternalH (tid ::: featureName ::: req ::: _) = setFeatureStatusInternalH (tid ::: featureName ::: req ::: _) =
(empty & setStatus status204) <$ (setFeatureStatusInternal tid featureName =<< fromJsonBody req) (empty & setStatus status204) <$ (setFeatureStatusInternal tid featureName =<< fromJsonBody req)
setFeatureStatusInternal :: TeamId -> Public.TeamFeatureName -> Public.TeamFeatu reStatus -> Galley () setFeatureStatusInternal :: TeamId -> Public.TeamFeatureName -> Public.TeamFeatu reStatus -> Galley ()
setFeatureStatusInternal tid featureName status = do setFeatureStatusInternal tid featureName status = do
case featureName of case featureName of
Public.TeamFeatureLegalHold -> setLegalholdStatusInternal tid status Public.TeamFeatureLegalHold -> setLegalholdStatusInternal tid status
Public.TeamFeatureSSO -> setSSOStatusInternal tid status Public.TeamFeatureSSO -> setSSOStatusInternal tid status
Public.TeamFeatureSearchVisibility -> setTeamSearchVisibilityAvailableIntern al tid status Public.TeamFeatureSearchVisibility -> setTeamSearchVisibilityAvailableIntern al tid status
Public.TeamFeatureValidateSAMLEmails -> setValidateSAMLEmailsInternal tid st atus Public.TeamFeatureValidateSAMLEmails -> setValidateSAMLEmailsInternal tid st atus
Public.TeamFeatureDigitalSignatures -> setDigitalSignaturesInternal tid stat us
getSSOStatusInternal :: TeamId -> Galley Public.TeamFeatureStatus getSSOStatusInternal :: TeamId -> Galley Public.TeamFeatureStatus
getSSOStatusInternal tid = do getSSOStatusInternal tid = do
defConfig <- do defConfig <- do
featureSSO <- view (options . optSettings . setFeatureFlags . flagSSO) featureSSO <- view (options . optSettings . setFeatureFlags . flagSSO)
pure $ case featureSSO of pure $ case featureSSO of
FeatureSSOEnabledByDefault -> Public.TeamFeatureEnabled FeatureSSOEnabledByDefault -> Public.TeamFeatureEnabled
FeatureSSODisabledByDefault -> Public.TeamFeatureDisabled FeatureSSODisabledByDefault -> Public.TeamFeatureDisabled
ssoTeamConfig <- TeamFeatures.getFlag tid Public.TeamFeatureSSO ssoTeamConfig <- TeamFeatures.getFlag tid Public.TeamFeatureSSO
pure . fromMaybe defConfig $ ssoTeamConfig pure . fromMaybe defConfig $ ssoTeamConfig
skipping to change at line 965 skipping to change at line 975
getValidateSAMLEmailsInternal :: TeamId -> Galley Public.TeamFeatureStatus getValidateSAMLEmailsInternal :: TeamId -> Galley Public.TeamFeatureStatus
getValidateSAMLEmailsInternal tid = getValidateSAMLEmailsInternal tid =
-- FUTUREWORK: we may also want to get a default from the server config file h ere, like for -- FUTUREWORK: we may also want to get a default from the server config file h ere, like for
-- sso, and team search visibility. -- sso, and team search visibility.
fromMaybe Public.TeamFeatureDisabled fromMaybe Public.TeamFeatureDisabled
<$> TeamFeatures.getFlag tid Public.TeamFeatureValidateSAMLEmails <$> TeamFeatures.getFlag tid Public.TeamFeatureValidateSAMLEmails
setValidateSAMLEmailsInternal :: TeamId -> Public.TeamFeatureStatus -> Galley () setValidateSAMLEmailsInternal :: TeamId -> Public.TeamFeatureStatus -> Galley ()
setValidateSAMLEmailsInternal tid = TeamFeatures.setFlag tid Public.TeamFeatureV alidateSAMLEmails setValidateSAMLEmailsInternal tid = TeamFeatures.setFlag tid Public.TeamFeatureV alidateSAMLEmails
getDigitalSignaturesInternal :: TeamId -> Galley Public.TeamFeatureStatus
getDigitalSignaturesInternal tid =
-- FUTUREWORK: we may also want to get a default from the server config file h
ere, like for
-- sso, and team search visibility.
fromMaybe Public.TeamFeatureDisabled
<$> TeamFeatures.getFlag tid Public.TeamFeatureDigitalSignatures
setDigitalSignaturesInternal :: TeamId -> Public.TeamFeatureStatus -> Galley ()
setDigitalSignaturesInternal tid = TeamFeatures.setFlag tid Public.TeamFeatureDi
gitalSignatures
-- | Modify and get visibility type for a team (internal, no user permission che cks) -- | Modify and get visibility type for a team (internal, no user permission che cks)
getSearchVisibilityInternalH :: TeamId ::: JSON -> Galley Response getSearchVisibilityInternalH :: TeamId ::: JSON -> Galley Response
getSearchVisibilityInternalH (tid ::: _) = getSearchVisibilityInternalH (tid ::: _) =
json <$> getSearchVisibilityInternal tid json <$> getSearchVisibilityInternal tid
getSearchVisibilityInternal :: TeamId -> Galley TeamSearchVisibilityView getSearchVisibilityInternal :: TeamId -> Galley TeamSearchVisibilityView
getSearchVisibilityInternal = fmap TeamSearchVisibilityView . SearchVisibilityDa ta.getSearchVisibility getSearchVisibilityInternal = fmap TeamSearchVisibilityView . SearchVisibilityDa ta.getSearchVisibility
setSearchVisibilityInternalH :: TeamId ::: JsonRequest TeamSearchVisibilityView ::: JSON -> Galley Response setSearchVisibilityInternalH :: TeamId ::: JsonRequest TeamSearchVisibilityView ::: JSON -> Galley Response
setSearchVisibilityInternalH (tid ::: req ::: _) = do setSearchVisibilityInternalH (tid ::: req ::: _) = do
 End of changes. 16 change blocks. 
16 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)