Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
00900141
Commit
00900141
authored
Sep 14, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] rmUser + gargMail (WIP)
parent
fb027ced
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
User.hs
src/Gargantext/Database/Action/User.hs
+13
-3
User.hs
src/Gargantext/Database/Query/Table/User.hs
+5
-0
No files found.
src/Gargantext/Database/Action/User.hs
View file @
00900141
...
...
@@ -14,14 +14,17 @@ Portability : POSIX
module
Gargantext.Database.Action.User
where
-- import Data.Maybe (catMaybes)
import
Gargantext.Database.Query.Table.User
import
Gargantext.Core.Types.Individu
import
Gargantext.Database.Prelude
import
Gargantext.Prelude
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
(
..
))
import
Gargantext.Prelude.Mail
(
gargMail
)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
(
..
),
nodeError
,
NodeError
(
..
))
import
Gargantext.Database.Action.Flow
(
getOrMkRoot
)
------------------------------------------------------------------------
mkUser
::
HasNodeError
err
=>
NewUser
GargPassword
->
Cmd
err
Int64
mkUser
u
=
mkUsers
[
u
]
...
...
@@ -30,8 +33,15 @@ mkUsers us = do
us'
<-
liftBase
$
mapM
toUserHash
us
r
<-
insertUsers
$
map
toUserWrite
us'
_
<-
mapM
getOrMkRoot
$
map
(
\
u
->
UserName
(
_nu_username
u
))
us
_
<-
liftBase
gargMail
pure
r
--
| TODO
--
----------------------------------------------------------------------
rmUser
::
HasNodeError
err
=>
User
->
Cmd
err
Int64
rmUser
=
undefined
rmUser
(
UserName
un
)
=
deleteUsers
[
un
]
rmUser
_
=
nodeError
NotImplYet
-- TODO
rmUsers
::
HasNodeError
err
=>
[
User
]
->
Cmd
err
Int64
rmUsers
[]
=
pure
0
rmUsers
_
=
undefined
src/Gargantext/Database/Query/Table/User.hs
View file @
00900141
...
...
@@ -20,6 +20,7 @@ Functions to deal with users, database side.
module
Gargantext.Database.Query.Table.User
(
insertUsers
,
toUserWrite
,
deleteUsers
,
queryUserTable
,
getUser
,
insertUsersDemo
...
...
@@ -52,6 +53,10 @@ insertUsers us = mkCmd $ \c -> runInsert_ c insert
where
insert
=
Insert
userTable
us
rCount
Nothing
deleteUsers
::
[
Username
]
->
Cmd
err
Int64
deleteUsers
us
=
mkCmd
$
\
c
->
runDelete
c
userTable
(
\
user
->
in_
(
map
pgStrictText
us
)
(
user_username
user
))
-----------------------------------------------------------------------
toUserWrite
::
NewUser
HashPassword
->
UserWrite
toUserWrite
(
NewUser
u
m
(
Auth
.
PasswordHash
p
))
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment