S2S: Project: Fix search of activities in DB
This commit is contained in:
parent
0b08a7692a
commit
f54caef7ca
1 changed files with 19 additions and 27 deletions
|
@ -351,16 +351,14 @@ projectAccept now projectID (Verse authorIdMsig body) accept = do
|
||||||
ident <- lift $ lift $ getComponentIdent componentID
|
ident <- lift $ lift $ getComponentIdent componentID
|
||||||
return (componentID, ident, Right ())
|
return (componentID, ident, Right ())
|
||||||
|
|
||||||
verifySourceHolder :: SourceId -> ActDBE ()
|
verifySourceHolder :: SourceId -> MaybeT ActDB ()
|
||||||
verifySourceHolder sourceID = do
|
verifySourceHolder sourceID = do
|
||||||
mh <- lift $ getValBy $ UniqueSourceHolderProject sourceID
|
SourceHolderProject _ j <- MaybeT $ getValBy $ UniqueSourceHolderProject sourceID
|
||||||
case mh of
|
guard $ j == projectID
|
||||||
Just (SourceHolderProject _ j) | j == projectID -> pure ()
|
|
||||||
_ -> throwE "Accept object is an Add for some other project/team"
|
|
||||||
|
|
||||||
tryAddChildActive' usID = do
|
tryAddChildActive' usID = do
|
||||||
SourceOriginUs sourceID <- lift . lift $ getJust usID
|
SourceOriginUs sourceID <- lift . lift $ getJust usID
|
||||||
ExceptT $ lift $ runExceptT $ verifySourceHolder sourceID
|
lift $ verifySourceHolder sourceID
|
||||||
topic <- do
|
topic <- do
|
||||||
t <- lift . lift $ getSourceTopic sourceID
|
t <- lift . lift $ getSourceTopic sourceID
|
||||||
bitraverse
|
bitraverse
|
||||||
|
@ -384,7 +382,7 @@ projectAccept now projectID (Verse authorIdMsig body) accept = do
|
||||||
|
|
||||||
tryAddChildPassive' themID = do
|
tryAddChildPassive' themID = do
|
||||||
SourceOriginThem sourceID <- lift . lift $ getJust themID
|
SourceOriginThem sourceID <- lift . lift $ getJust themID
|
||||||
ExceptT $ lift $ runExceptT $ verifySourceHolder sourceID
|
lift $ verifySourceHolder sourceID
|
||||||
topic <- do
|
topic <- do
|
||||||
t <- lift . lift $ getSourceTopic sourceID
|
t <- lift . lift $ getSourceTopic sourceID
|
||||||
bitraverse
|
bitraverse
|
||||||
|
@ -406,16 +404,14 @@ projectAccept now projectID (Verse authorIdMsig body) accept = do
|
||||||
lift $ MaybeT $ getValBy $ UniqueSourceThemGestureRemoteAdd remoteActivityID
|
lift $ MaybeT $ getValBy $ UniqueSourceThemGestureRemoteAdd remoteActivityID
|
||||||
tryAddChildPassive' themID
|
tryAddChildPassive' themID
|
||||||
|
|
||||||
verifyDestHolder :: DestId -> ActDBE ()
|
verifyDestHolder :: DestId -> MaybeT ActDB ()
|
||||||
verifyDestHolder destID = do
|
verifyDestHolder destID = do
|
||||||
mh <- lift $ getValBy $ UniqueDestHolderProject destID
|
DestHolderProject _ j <- MaybeT $ getValBy $ UniqueDestHolderProject destID
|
||||||
case mh of
|
guard $ j == projectID
|
||||||
Just (DestHolderProject _ j) | j == projectID -> pure ()
|
|
||||||
_ -> throwE "Accept object is an Add for some other project/team"
|
|
||||||
|
|
||||||
tryAddParentActive' destID = do
|
tryAddParentActive' destID = do
|
||||||
usID <- lift $ MaybeT $ getKeyBy $ UniqueDestOriginUs destID
|
usID <- lift $ MaybeT $ getKeyBy $ UniqueDestOriginUs destID
|
||||||
ExceptT $ lift $ runExceptT $ verifyDestHolder destID
|
lift $ verifyDestHolder destID
|
||||||
topic <- do
|
topic <- do
|
||||||
t <- lift . lift $ getDestTopic destID
|
t <- lift . lift $ getDestTopic destID
|
||||||
bitraverse
|
bitraverse
|
||||||
|
@ -439,7 +435,7 @@ projectAccept now projectID (Verse authorIdMsig body) accept = do
|
||||||
|
|
||||||
tryAddParentPassive' themID = do
|
tryAddParentPassive' themID = do
|
||||||
DestOriginThem destID <- lift . lift $ getJust themID
|
DestOriginThem destID <- lift . lift $ getJust themID
|
||||||
ExceptT $ lift $ runExceptT $ verifyDestHolder destID
|
lift $ verifyDestHolder destID
|
||||||
topic <- do
|
topic <- do
|
||||||
t <- lift . lift $ getDestTopic destID
|
t <- lift . lift $ getDestTopic destID
|
||||||
bitraverse
|
bitraverse
|
||||||
|
@ -465,7 +461,7 @@ projectAccept now projectID (Verse authorIdMsig body) accept = do
|
||||||
SourceRemove sendID _ <-
|
SourceRemove sendID _ <-
|
||||||
lift $ MaybeT $ getValBy $ UniqueSourceRemove itemID
|
lift $ MaybeT $ getValBy $ UniqueSourceRemove itemID
|
||||||
SourceUsSendDelegator sourceID grantID <- lift $ lift $ getJust sendID
|
SourceUsSendDelegator sourceID grantID <- lift $ lift $ getJust sendID
|
||||||
ExceptT $ lift $ runExceptT $ verifySourceHolder sourceID
|
lift $ verifySourceHolder sourceID
|
||||||
topic <- do
|
topic <- do
|
||||||
t <- lift . lift $ getSourceTopic sourceID
|
t <- lift . lift $ getSourceTopic sourceID
|
||||||
bitraverse
|
bitraverse
|
||||||
|
@ -4902,16 +4898,14 @@ projectRevoke now projectID (Verse authorIdMsig body) (AP.Revoke (luFirst :| lus
|
||||||
|
|
||||||
where
|
where
|
||||||
|
|
||||||
verifyDestHolder :: DestId -> ActDBE ()
|
verifyDestHolder :: DestId -> MaybeT ActDB ()
|
||||||
verifyDestHolder destID = do
|
verifyDestHolder destID = do
|
||||||
mh <- lift $ getValBy $ UniqueDestHolderProject destID
|
DestHolderProject _ j <- MaybeT $ getValBy $ UniqueDestHolderProject destID
|
||||||
case mh of
|
guard $ j == projectID
|
||||||
Just (DestHolderProject _ j) | j == projectID -> pure ()
|
|
||||||
_ -> throwE "Revoke object is a Grant for some other project/team"
|
|
||||||
|
|
||||||
tryParent' usAcceptID send = do
|
tryParent' usAcceptID send = do
|
||||||
DestUsAccept destID _ <- lift $ lift $ getJust usAcceptID
|
DestUsAccept destID _ <- lift $ lift $ getJust usAcceptID
|
||||||
ExceptT $ lift $ runExceptT $ verifyDestHolder destID
|
lift $ verifyDestHolder destID
|
||||||
topic <- do
|
topic <- do
|
||||||
t <- lift . lift $ getDestTopic destID
|
t <- lift . lift $ getDestTopic destID
|
||||||
bitraverse
|
bitraverse
|
||||||
|
@ -4933,15 +4927,13 @@ projectRevoke now projectID (Verse authorIdMsig body) (AP.Revoke (luFirst :| lus
|
||||||
lift $ MaybeT $ getBy $ UniqueDestThemSendDelegatorRemoteGrant remoteActivityID
|
lift $ MaybeT $ getBy $ UniqueDestThemSendDelegatorRemoteGrant remoteActivityID
|
||||||
tryParent' usAcceptID (Right sendID) --(Right remoteID)
|
tryParent' usAcceptID (Right sendID) --(Right remoteID)
|
||||||
|
|
||||||
verifySourceHolder :: SourceId -> ActDBE ()
|
verifySourceHolder :: SourceId -> MaybeT ActDB ()
|
||||||
verifySourceHolder sourceID = do
|
verifySourceHolder sourceID = do
|
||||||
mh <- lift $ getValBy $ UniqueSourceHolderProject sourceID
|
SourceHolderProject _ j <- MaybeT $ getValBy $ UniqueSourceHolderProject sourceID
|
||||||
case mh of
|
guard $ j == projectID
|
||||||
Just (SourceHolderProject _ j) | j == projectID -> pure ()
|
|
||||||
_ -> throwE "Revoked object is a Grant for some other project/team"
|
|
||||||
|
|
||||||
tryChild' sourceID child = do
|
tryChild' sourceID child = do
|
||||||
ExceptT $ lift $ runExceptT $ verifySourceHolder sourceID
|
lift $ verifySourceHolder sourceID
|
||||||
sendID <- lift $ MaybeT $ getKeyBy $ UniqueSourceUsSendDelegator sourceID
|
sendID <- lift $ MaybeT $ getKeyBy $ UniqueSourceUsSendDelegator sourceID
|
||||||
return (sendID, child)
|
return (sendID, child)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue