From 12e228438953bfbfaea4da1e1ffec91b6305d024 Mon Sep 17 00:00:00 2001 From: Pere Lev Date: Thu, 7 Dec 2023 18:50:44 +0200 Subject: [PATCH] C2S: When creating a resource, insert a Permit record --- src/Vervis/Actor/Person/Client.hs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Vervis/Actor/Person/Client.hs b/src/Vervis/Actor/Person/Client.hs index a0adfc4..8db73f2 100644 --- a/src/Vervis/Actor/Person/Client.hs +++ b/src/Vervis/Actor/Person/Client.hs @@ -360,6 +360,7 @@ clientAdd now personMeID (ClientMsg maybeCap localRecips remoteRecips fwdHosts a -- Meaning: The human wants to create a ticket tracker -- Behavior: -- * Create a deck on DB +-- * Create a Permit record in DB -- * Launch a deck actor -- * Record a FollowRequest in DB -- * Create and send Create and Follow to it @@ -389,6 +390,14 @@ clientCreateDeck now personMeID (ClientMsg maybeCap localRecips remoteRecips fwd (deckID, deckFollowerSetID) <- lift $ insertDeck now name msummary createID wid actorMeID + -- Insert a Permit record + lift $ do + permitID <- insert $ Permit personMeID AP.RoleAdmin + topicID <- insert $ PermitTopicLocal permitID + insert_ $ PermitTopicDeck topicID deckID + insert_ $ PermitFulfillsTopicCreation permitID + insert_ $ PermitPersonGesture permitID createID + -- Insert the Create activity to my outbox deckHash <- encodeKeyHashid deckID actionCreate <- prepareCreate name msummary deckHash @@ -525,6 +534,7 @@ clientCreateDeck now personMeID (ClientMsg maybeCap localRecips remoteRecips fwd -- Meaning: The human wants to create a project -- Behavior: -- * Create a project on DB +-- * Create a Permit record in DB -- * Launch a project actor -- * Record a FollowRequest in DB -- * Create and send Create and Follow to it @@ -553,6 +563,13 @@ clientCreateProject now personMeID (ClientMsg maybeCap localRecips remoteRecips (projectID, projectFollowerSetID) <- insertProject now name msummary createID actorMeID + -- Insert a Permit record + permitID <- insert $ Permit personMeID AP.RoleAdmin + topicID <- insert $ PermitTopicLocal permitID + insert_ $ PermitTopicProject topicID projectID + insert_ $ PermitFulfillsTopicCreation permitID + insert_ $ PermitPersonGesture permitID createID + -- Insert the Create activity to my outbox projectHash <- lift $ encodeKeyHashid projectID actionCreate <- lift $ prepareCreate name msummary projectHash @@ -682,6 +699,7 @@ clientCreateProject now personMeID (ClientMsg maybeCap localRecips remoteRecips -- Meaning: The human wants to create a team -- Behavior: -- * Create a team on DB +-- * Create a Permit record in DB -- * Launch a team actor -- * Record a FollowRequest in DB -- * Create and send Create and Follow to it @@ -710,6 +728,13 @@ clientCreateTeam now personMeID (ClientMsg maybeCap localRecips remoteRecips fwd (groupID, projectFollowerSetID) <- insertTeam now name msummary createID actorMeID + -- Insert a Permit record + permitID <- insert $ Permit personMeID AP.RoleAdmin + topicID <- insert $ PermitTopicLocal permitID + insert_ $ PermitTopicGroup topicID groupID + insert_ $ PermitFulfillsTopicCreation permitID + insert_ $ PermitPersonGesture permitID createID + -- Insert the Create activity to my outbox groupHash <- lift $ encodeKeyHashid groupID actionCreate <- lift $ prepareCreate name msummary groupHash