2014-09-06 06:56:36 +00:00
|
|
|
module Handler.Admin where
|
|
|
|
|
|
|
|
import Import
|
|
|
|
|
|
|
|
getAdminR :: Handler Html
|
|
|
|
getAdminR = do
|
|
|
|
msu <- lookupSession "userId"
|
|
|
|
case msu of
|
|
|
|
Just tempUserId -> do
|
|
|
|
userId <- return $ getUserIdFromText tempUserId
|
|
|
|
user <- runDB $ getJust userId
|
|
|
|
case userAdmin user of
|
|
|
|
True -> do
|
|
|
|
defaultLayout $ do
|
2014-09-24 21:03:18 +00:00
|
|
|
setTitle "Administration: Menu"
|
2014-09-06 06:56:36 +00:00
|
|
|
$(widgetFile "adminBase")
|
|
|
|
False -> do
|
|
|
|
setMessage "You have no admin rights"
|
|
|
|
redirect $ HomeR
|
|
|
|
Nothing -> do
|
|
|
|
setMessage "You are not logged in"
|
|
|
|
redirect $ LoginR
|