diff options
author | Joris | 2015-09-05 13:53:36 +0200 |
---|---|---|
committer | Joris | 2015-09-05 13:53:36 +0200 |
commit | 3b738e0d4cc65f314da7389d4542ec826ba0f454 (patch) | |
tree | ee99236117ad698974c5a6e40ab170f617cb06f3 /src/server/Controller/User.hs | |
parent | 139d4a103a6a48880e5f12a796033956f223563c (diff) |
Using UserId instead of UserName to indentify users
Diffstat (limited to 'src/server/Controller/User.hs')
-rw-r--r-- | src/server/Controller/User.hs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/server/Controller/User.hs b/src/server/Controller/User.hs new file mode 100644 index 0000000..95e5fa8 --- /dev/null +++ b/src/server/Controller/User.hs @@ -0,0 +1,25 @@ +module Controller.User + ( getUsersAction + , whoAmIAction + ) where + +import Web.Scotty + +import Control.Monad.IO.Class (liftIO) + +import qualified Secure + +import Model.Database +import Model.User + +getUsersAction :: ActionM () +getUsersAction = + Secure.loggedAction (\_ -> do + (liftIO $ map getJsonUser <$> runDb getUsers) >>= json + ) + +whoAmIAction :: ActionM () +whoAmIAction = + Secure.loggedAction (\user -> do + json (getJsonUser user) + ) |