"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "services/brig/src/Brig/Provider/API.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).

API.hs  (wire-server-2020-06-10):API.hs  (wire-server-2020-06-19)
skipping to change at line 838 skipping to change at line 838
svp <- DB.lookupServiceProfile pid sid >>= maybeServiceNotFound svp <- DB.lookupServiceProfile pid sid >>= maybeServiceNotFound
for_ (cnvTeam cnv) $ \tid -> do for_ (cnvTeam cnv) $ \tid -> do
whitelisted <- DB.getServiceWhitelistStatus tid pid sid whitelisted <- DB.getServiceWhitelistStatus tid pid sid
unless whitelisted $ unless whitelisted $
throwStd serviceNotWhitelisted throwStd serviceNotWhitelisted
-- Prepare a user ID, client ID and token for the bot. -- Prepare a user ID, client ID and token for the bot.
bid <- BotId <$> randomId bid <- BotId <$> randomId
btk <- Text.decodeLatin1 . toByteString' <$> ZAuth.newBotToken pid bid cid btk <- Text.decodeLatin1 . toByteString' <$> ZAuth.newBotToken pid bid cid
let bcl = newClientId (fromIntegral (hash bid)) let bcl = newClientId (fromIntegral (hash bid))
-- Ask the external service to create a bot -- Ask the external service to create a bot
let origmem = OtherMember zuid Nothing roleNameWireAdmin let origmem = OtherMember (makeIdOpaque zuid) Nothing roleNameWireAdmin
let members = origmem : (cmOthers mems) let members = origmem : (cmOthers mems)
let bcnv = Ext.botConvView (cnvId cnv) (cnvName cnv) members let bcnv = Ext.botConvView (cnvId cnv) (cnvName cnv) members
let busr = mkBotUserView zusr let busr = mkBotUserView zusr
let bloc = fromMaybe (userLocale zusr) (addBotLocale add) let bloc = fromMaybe (userLocale zusr) (addBotLocale add)
let botReq = Ext.NewBotRequest bid bcl busr bcnv btk bloc let botReq = Ext.NewBotRequest bid bcl busr bcnv btk bloc
rs <- RPC.createBot scon botReq !>> StdError . serviceError rs <- RPC.createBot scon botReq !>> StdError . serviceError
-- Insert the bot user and client -- Insert the bot user and client
locale <- setDefaultLocale <$> view settings locale <- setDefaultLocale <$> view settings
let name = fromMaybe (serviceProfileName svp) (Ext.rsNewBotName rs) let name = fromMaybe (serviceProfileName svp) (Ext.rsNewBotName rs)
let assets = fromMaybe (serviceProfileAssets svp) (Ext.rsNewBotAssets rs) let assets = fromMaybe (serviceProfileAssets svp) (Ext.rsNewBotAssets rs)
skipping to change at line 888 skipping to change at line 888
removeBot :: UserId -> ConnId -> ConvId -> BotId -> Handler (Maybe Public.Remove BotResponse) removeBot :: UserId -> ConnId -> ConvId -> BotId -> Handler (Maybe Public.Remove BotResponse)
removeBot zusr zcon cid bid = do removeBot zusr zcon cid bid = do
-- Get the conversation and check preconditions -- Get the conversation and check preconditions
cnv <- lift (RPC.getConv zusr cid) >>= maybeConvNotFound cnv <- lift (RPC.getConv zusr cid) >>= maybeConvNotFound
let mems = cnvMembers cnv let mems = cnvMembers cnv
unless (cnvType cnv == RegularConv) $ unless (cnvType cnv == RegularConv) $
throwStd invalidConv throwStd invalidConv
-- Find the bot in the member list and delete it -- Find the bot in the member list and delete it
let busr = botUserId bid let busr = botUserId bid
let bot = List.find ((== busr) . omId) (cmOthers mems) let bot = List.find ((== makeIdOpaque busr) . omId) (cmOthers mems)
case bot >>= omService of case bot >>= omService of
Nothing -> return Nothing Nothing -> return Nothing
Just _ -> do Just _ -> do
lift $ Public.RemoveBotResponse <$$> deleteBot zusr (Just zcon) bid cid lift $ Public.RemoveBotResponse <$$> deleteBot zusr (Just zcon) bid cid
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Bot API -- Bot API
botGetSelfH :: BotId -> Handler Response botGetSelfH :: BotId -> Handler Response
botGetSelfH bot = json <$> botGetSelf bot botGetSelfH bot = json <$> botGetSelf bot
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

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