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)
33 import System.Environment (getArgs)
34 import Gargantext.Database.Action.User.New (newUsers)
38 params@[iniPath,email] <- getArgs
40 _ <- if length params /= 2
41 then panic "USAGE: ./gargantext-init gargantext.ini student@university.edu"
44 cfg <- readConfig iniPath
46 let createUsers :: CmdR GargError Int64
47 createUsers = newUsers [cs email]
49 withDevEnv iniPath $ \env -> do
50 _ <- runCmdDev env createUsers