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
|
"romang@amu.edu.pl" -> True
|
||||||
"junczys@amu.edu.pl" -> True
|
"junczys@amu.edu.pl" -> True
|
||||||
"rafalj@amu.edu.pl" -> True
|
"rafalj@amu.edu.pl" -> True
|
||||||
_ -> False
|
_ -> True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -172,6 +172,7 @@ instance YesodAuth App where
|
|||||||
{ userIdent = credsIdent creds
|
{ userIdent = credsIdent creds
|
||||||
, userPassword = Nothing
|
, userPassword = Nothing
|
||||||
, userName = Nothing
|
, userName = Nothing
|
||||||
|
, userIsAdmin = False
|
||||||
}
|
}
|
||||||
|
|
||||||
-- You can add other plugins like BrowserID, email or OAuth here
|
-- You can add other plugins like BrowserID, email or OAuth here
|
||||||
|
@ -33,7 +33,13 @@ postCreateChallengeR = do
|
|||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
Just (name, publicUrl, publicBranch, privateUrl, privateBranch) = challengeData
|
Just (name, publicUrl, publicBranch, privateUrl, privateBranch) = challengeData
|
||||||
|
|
||||||
|
userId <- requireAuthId
|
||||||
|
user <- runDB $ get404 userId
|
||||||
|
if userIsAdmin user
|
||||||
|
then
|
||||||
runViewProgress $ doCreateChallenge name publicUrl publicBranch privateUrl privateBranch
|
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 :: Text -> Text -> Text -> Text -> Text -> Channel -> Handler ()
|
||||||
doCreateChallenge name publicUrl publicBranch privateUrl privateBranch chan = do
|
doCreateChallenge name publicUrl publicBranch privateUrl privateBranch chan = do
|
||||||
|
@ -3,6 +3,7 @@ User
|
|||||||
password Text Maybe
|
password Text Maybe
|
||||||
UniqueUser ident
|
UniqueUser ident
|
||||||
name Text Maybe
|
name Text Maybe
|
||||||
|
isAdmin Bool default=True
|
||||||
deriving Typeable
|
deriving Typeable
|
||||||
Email
|
Email
|
||||||
email Text
|
email Text
|
||||||
|
Loading…
Reference in New Issue
Block a user