Repo collaborator removal

This commit is contained in:
fr33domlover 2016-05-30 14:32:20 +00:00
parent d655e7302e
commit 40add444ba

View file

@ -231,7 +231,24 @@ getRepoDevR :: ShrIdent -> RpIdent -> ShrIdent -> Handler Html
getRepoDevR shr rp dev = error "Not implemented"
deleteRepoDevR :: ShrIdent -> RpIdent -> ShrIdent -> Handler Html
deleteRepoDevR shr rp dev = error "Not implemented"
deleteRepoDevR shr rp dev = do
runDB $ do
rid <- do
Entity s _ <- getBy404 $ UniqueSharer shr
Entity r _ <- getBy404 $ UniqueRepo rp s
return r
pid <- do
Entity s _ <- getBy404 $ UniqueSharer dev
Entity p _ <- getBy404 $ UniquePersonIdent s
return p
Entity cid _collab <- getBy404 $ UniqueCollab rid pid
delete cid
setMessage "Collaborator removed."
redirect $ RepoDevsR shr rp
postRepoDevR :: ShrIdent -> RpIdent -> ShrIdent -> Handler Html
postRepoDevR shr rp dev = error "Not implemented"
postRepoDevR shr rp dev = do
mmethod <- lookupPostParam "_method"
case mmethod of
Just "DELETE" -> deleteRepoDevR shr rp dev
_ -> notFound