S2S: Project: Remove: Child-active: Revoke Grants-for-teams

This commit is contained in:
Pere Lev 2024-06-06 21:36:39 +03:00
parent 3afdfbf3d7
commit 7af44d693c
No known key found for this signature in database
GPG key ID: 5252C5C863E5E57D

View file

@ -5060,6 +5060,7 @@ projectRemove now projectID (Verse authorIdMsig body) remove = do
-- Grab extension-Grants that I'm about to revoke
gathers <- selectList [SourceUsGatherSource ==. sendID] []
leafs <- selectList [SourceUsLeafSource ==. sendID] []
conveys <- selectList [SourceUsConveySource ==. sendID] []
-- Delete the whole Source record
deleteWhere [SourceRemoveSend ==. sendID]
@ -5073,6 +5074,10 @@ projectRemove now projectID (Verse authorIdMsig body) remove = do
deleteWhere [SourceUsLeafToLocalLeaf <-. leafIDs]
deleteWhere [SourceUsLeafToRemoteLeaf <-. leafIDs]
deleteWhere [SourceUsLeafId <-. leafIDs]
let conveyIDs = map entityKey conveys
deleteWhere [SourceUsConveyFromLocalConvey <-. conveyIDs]
deleteWhere [SourceUsConveyFromRemoteConvey <-. conveyIDs]
deleteWhere [SourceUsConveyId <-. conveyIDs]
case topic of
Left (localID, _, _) -> do
deleteWhere [SourceThemDelegateLocalSource ==. localID]
@ -5141,7 +5146,12 @@ projectRemove now projectID (Verse authorIdMsig body) remove = do
recip
, grantID
)
revokes <- for (revokesG ++ revokesL) $ \ (actor, grantID) -> do
revokesC <- for conveys $ \ (Entity _ (SourceUsConvey _ startID grantID)) -> do
SquadUsStart acceptID _ <- getJust startID
SquadUsAccept squadID _ <- getJust acceptID
team <- bimap snd snd <$> getSquadTeam squadID
return (first LocalActorGroup team, grantID)
revokes <- for (revokesG ++ revokesL ++ revokesC) $ \ (actor, grantID) -> do
ext@(actionExt, _, _, _) <- prepareExtRevoke actor grantID
let recipByKey = LocalActorProject projectID
extID <- insertEmptyOutboxItem' (actorOutbox actorRecip) now