forked from filipg/gonito
change triggering
This commit is contained in:
parent
5cad8dcbfe
commit
d79e03e956
@ -118,13 +118,13 @@ postChallengeSubmissionR name = do
|
|||||||
|
|
||||||
postTriggerRemotelyR :: Handler TypedContent
|
postTriggerRemotelyR :: Handler TypedContent
|
||||||
postTriggerRemotelyR = do
|
postTriggerRemotelyR = do
|
||||||
(Just token) <- lookupPostParam "token"
|
(Just localId) <- lookupPostParam "id"
|
||||||
(Just name) <- lookupPostParam "challenge"
|
(Just name) <- lookupPostParam "challenge"
|
||||||
(Just url) <- lookupPostParam "url"
|
(Just url) <- lookupPostParam "url"
|
||||||
mBranch <- lookupPostParam "branch"
|
mBranch <- lookupPostParam "branch"
|
||||||
let branch = fromMaybe "master" mBranch
|
let branch = fromMaybe "master" mBranch
|
||||||
Entity challengeId _ <- runDB $ getBy404 $ UniqueName name
|
Entity challengeId _ <- runDB $ getBy404 $ UniqueName name
|
||||||
[Entity userId _] <- runDB $ selectList [UserTriggerToken ==. Just token] []
|
[Entity userId _] <- runDB $ selectList [UserLocalId ==. Just localId] []
|
||||||
isPermitted <- canTrigger userId name url
|
isPermitted <- canTrigger userId name url
|
||||||
if isPermitted
|
if isPermitted
|
||||||
then
|
then
|
||||||
|
Loading…
Reference in New Issue
Block a user