Commit b9d79d92 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[INIT] user.

parent 8237d093
Pipeline #557 failed with stage
...@@ -39,17 +39,17 @@ issues. ...@@ -39,17 +39,17 @@ issues.
### Initialization ### Initialization
Users has to be created first Users has to be created first (user1 is created as instance):
1. stack ghci
2. runCmd insertUsersDemo
Then you can log in with user1:1resu - stack install
- ~/.local/bin/gargantext-init "gargantext.ini"
## Use Cases ## Use Cases
### Multi-User with Graphical User Interface (Server Mode) ### Multi-User with Graphical User Interface (Server Mode)
~/.local/bin/stack --docker exec gargantext-server -- --ini "gargantext.ini" --run Prod ~/.local/bin/stack --docker exec gargantext-server -- --ini "gargantext.ini" --run Prod
Then you can log in with user1:1resu
### Command Line Mode tools ### Command Line Mode tools
......
...@@ -319,6 +319,20 @@ executables: ...@@ -319,6 +319,20 @@ executables:
- base - base
- servant-server - servant-server
gargantext-init:
main: Main.hs
source-dirs: bin/gargantext-init
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -O2
- -Wmissing-signatures
dependencies:
- gargantext
- base
tests: tests:
# garg-test: # garg-test:
# main: Main.hs # main: Main.hs
......
...@@ -246,10 +246,9 @@ insertMasterDocs c lang hs = do ...@@ -246,10 +246,9 @@ insertMasterDocs c lang hs = do
type CorpusName = Text type CorpusName = Text
getOrMkRootWithCorpus :: (HasNodeError err, MkCorpus a)
=> Username -> Either CorpusName [CorpusId] -> Maybe a getOrMkRoot :: (HasNodeError err) => Username -> Cmd err (UserId, RootId)
-> Cmd err (UserId, RootId, CorpusId) getOrMkRoot username = do
getOrMkRootWithCorpus username cName c = do
maybeUserId <- getUser username maybeUserId <- getUser username
userId <- case maybeUserId of userId <- case maybeUserId of
Nothing -> nodeError NoUserFound Nothing -> nodeError NoUserFound
...@@ -264,7 +263,14 @@ getOrMkRootWithCorpus username cName c = do ...@@ -264,7 +263,14 @@ getOrMkRootWithCorpus username cName c = do
False -> pure rootId' False -> pure rootId'
rootId <- maybe (nodeError NoRootFound) pure (head rootId'') rootId <- maybe (nodeError NoRootFound) pure (head rootId'')
pure (userId, rootId)
getOrMkRootWithCorpus :: (HasNodeError err, MkCorpus a)
=> Username -> Either CorpusName [CorpusId] -> Maybe a
-> Cmd err (UserId, RootId, CorpusId)
getOrMkRootWithCorpus username cName c = do
(userId, rootId) <- getOrMkRoot username
corpusId'' <- if username == userMaster corpusId'' <- if username == userMaster
then do then do
ns <- getCorporaWithParentId rootId ns <- getCorporaWithParentId rootId
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment