forked from filipg/gonito
accept all, add admin role
This commit is contained in:
parent
010d582eae
commit
5aba62400b
@ -63,7 +63,7 @@ isTrusted user =
|
||||
"romang@amu.edu.pl" -> True
|
||||
"junczys@amu.edu.pl" -> True
|
||||
"rafalj@amu.edu.pl" -> True
|
||||
_ -> False
|
||||
_ -> True
|
||||
|
||||
|
||||
|
||||
@ -172,6 +172,7 @@ instance YesodAuth App where
|
||||
{ userIdent = credsIdent creds
|
||||
, userPassword = Nothing
|
||||
, userName = Nothing
|
||||
, userIsAdmin = False
|
||||
}
|
||||
|
||||
-- You can add other plugins like BrowserID, email or OAuth here
|
||||
|
@ -33,7 +33,13 @@ postCreateChallengeR = do
|
||||
_ -> Nothing
|
||||
Just (name, publicUrl, publicBranch, privateUrl, privateBranch) = challengeData
|
||||
|
||||
runViewProgress $ doCreateChallenge name publicUrl publicBranch privateUrl privateBranch
|
||||
userId <- requireAuthId
|
||||
user <- runDB $ get404 userId
|
||||
if userIsAdmin user
|
||||
then
|
||||
runViewProgress $ doCreateChallenge name publicUrl publicBranch privateUrl privateBranch
|
||||
else
|
||||
runViewProgress $ (flip err) "MUST BE AN ADMIN TO CREATE A CHALLENGE"
|
||||
|
||||
doCreateChallenge :: Text -> Text -> Text -> Text -> Text -> Channel -> Handler ()
|
||||
doCreateChallenge name publicUrl publicBranch privateUrl privateBranch chan = do
|
||||
|
@ -3,6 +3,7 @@ User
|
||||
password Text Maybe
|
||||
UniqueUser ident
|
||||
name Text Maybe
|
||||
isAdmin Bool default=True
|
||||
deriving Typeable
|
||||
Email
|
||||
email Text
|
||||
|
Loading…
Reference in New Issue
Block a user