3 Description : GarganText Mailing Invitations
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
13 {-# LANGUAGE Strict #-}
17 import Data.Either (Either(..))
18 import Gargantext.API.Dev (withDevEnv, runCmdDev)
19 import Gargantext.API.Node () -- instances only
20 import Gargantext.API.Prelude (GargError)
21 import Gargantext.Core.Types.Individu (User(..), arbitraryNewUsers, NewUser(..), arbitraryUsername, GargPassword(..))
22 import Gargantext.Database.Action.Flow (getOrMkRoot, getOrMk_RootWithCorpus)
23 import Gargantext.Database.Admin.Config (userMaster, corpusMasterName)
24 import Gargantext.Database.Admin.Trigger.Init (initFirstTriggers, initLastTriggers)
25 import Gargantext.Database.Admin.Types.Hyperdata (HyperdataCorpus)
26 import Gargantext.Database.Admin.Types.Node
27 import Gargantext.Database.Prelude (CmdR)
28 import Gargantext.Database.Query.Table.Node (getOrMkList)
29 import Gargantext.Database.Query.Table.User (insertNewUsers, )
30 import Gargantext.Prelude
31 import Gargantext.Prelude.Config (GargConfig(..), readConfig)
32 import Prelude (getLine, read)
33 import System.Environment (getArgs)
34 import Gargantext.Database.Action.User.New (newUsers)
35 import Gargantext.Core.Types.Individu (User(..))
36 import qualified Gargantext.API.Node.Share as Share
40 params@[iniPath,user,node_id,email] <- getArgs
42 _ <- if length params /= 4
43 then panic "USAGE: ./gargantext-init gargantext.ini username node_id student@university.edu"
46 cfg <- readConfig iniPath
48 let invite :: CmdR GargError Int
49 invite = Share.api (UserName $ cs user) (NodeId $ (read node_id :: Int)) (Share.ShareTeamParams $ cs email)
51 withDevEnv iniPath $ \env -> do
52 _ <- runCmdDev env invite