1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 17:34:52 +09:00

Add a ProjectCollabLiveR route for use as Grant revocation URI

This commit is contained in:
Pere Lev 2023-06-28 22:24:01 +03:00
parent 4a2f97d9dd
commit afb83b7761
No known key found for this signature in database
GPG key ID: 5252C5C863E5E57D
3 changed files with 15 additions and 0 deletions

View file

@ -158,6 +158,7 @@ type TicketDeckKeyHashid = KeyHashid TicketDeck
type TicketLoomKeyHashid = KeyHashid TicketLoom type TicketLoomKeyHashid = KeyHashid TicketLoom
type SigKeyKeyHashid = KeyHashid SigKey type SigKeyKeyHashid = KeyHashid SigKey
type ProjectKeyHashid = KeyHashid Project type ProjectKeyHashid = KeyHashid Project
type CollabEnableKeyHashid = KeyHashid CollabEnable
-- This is where we define all of the routes in our application. For a full -- This is where we define all of the routes in our application. For a full
-- explanation of the syntax, please see: -- explanation of the syntax, please see:
@ -1006,3 +1007,4 @@ instance YesodBreadcrumbs App where
ProjectRemoveR _ _ -> ("", Nothing) ProjectRemoveR _ _ -> ("", Nothing)
ProjectComponentsR j -> ("Components", Just $ ProjectR j) ProjectComponentsR j -> ("Components", Just $ ProjectR j)
ProjectCollabLiveR j c -> (keyHashidText c, Just $ ProjectCollabsR j)

View file

@ -34,6 +34,7 @@ module Vervis.Handler.Project
, postProjectRemoveR , postProjectRemoveR
, getProjectComponentsR , getProjectComponentsR
, getProjectCollabLiveR
) )
where where
@ -413,3 +414,14 @@ getProjectComponentsR projectHash = do
E.on $ comp E.^. ComponentId E.==. enable E.^. ComponentEnableComponent E.on $ comp E.^. ComponentId E.==. enable E.^. ComponentEnableComponent
E.where_ $ comp E.^. ComponentProject E.==. E.val projectID E.where_ $ comp E.^. ComponentProject E.==. E.val projectID
return (i E.^. InstanceHost, ro E.^. RemoteObjectIdent) return (i E.^. InstanceHost, ro E.^. RemoteObjectIdent)
getProjectCollabLiveR
:: KeyHashid Project -> KeyHashid CollabEnable -> Handler ()
getProjectCollabLiveR projectHash enableHash = do
projectID <- decodeKeyHashid404 projectHash
enableID <- decodeKeyHashid404 enableHash
runDB $ do
CollabEnable collabID _ <- get404 enableID
CollabTopicProject _ j <-
getValBy404 $ UniqueCollabTopicProject collabID
unless (j == projectID) notFound

View file

@ -328,3 +328,4 @@
/projects/#ProjectKeyHashid/remove/#CollabTopicProjectId ProjectRemoveR POST /projects/#ProjectKeyHashid/remove/#CollabTopicProjectId ProjectRemoveR POST
/projects/#ProjectKeyHashid/components ProjectComponentsR GET /projects/#ProjectKeyHashid/components ProjectComponentsR GET
/projects/#ProjectKeyHashid/collabs/#CollabEnableKeyHashid/live ProjectCollabLiveR GET