From df4a2b221e82c4b19b4e94929a24d643e88ee42d Mon Sep 17 00:00:00 2001 From: Pere Lev Date: Tue, 6 Aug 2024 15:37:49 +0300 Subject: [PATCH] DB, S2S: Factory: Record set of allowed types --- src/Vervis/Actor/Factory.hs | 7 +++++++ src/Vervis/Actor/Person/Client.hs | 5 ++++- src/Vervis/Migration.hs | 6 ++++++ th/models | 5 ++++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Vervis/Actor/Factory.hs b/src/Vervis/Actor/Factory.hs index 1f17373..feab317 100644 --- a/src/Vervis/Actor/Factory.hs +++ b/src/Vervis/Actor/Factory.hs @@ -138,6 +138,13 @@ factoryCreateNew new now factoryMeID (Verse authorIdMsig body) detail = do (newLocalResource, launchNewActor, sendInit, newResourceID) <- insertNewActor now name msummary createDB actorMeID + -- Verify this actor type is enabled + let allow NADeck = factoryAllowDeck + allow NAProject = factoryAllowProject + allow NATeam = factoryAllowTeam + unless (allow new factoryMe) $ + throwE "I don't support this actor type" + -- Prepare forwarding the Create to my followers factoryHash <- encodeKeyHashid factoryMeID let sieve = diff --git a/src/Vervis/Actor/Person/Client.hs b/src/Vervis/Actor/Person/Client.hs index 00f937d..7e1ff5a 100644 --- a/src/Vervis/Actor/Person/Client.hs +++ b/src/Vervis/Actor/Person/Client.hs @@ -531,7 +531,10 @@ clientCreateFactory now personMeID (ClientMsg maybeCap localRecips remoteRecips Entity aid a <- insertActor now name (fromMaybe "" msummary) (Left (LocalActorPerson personMeID, actorMeID, obiidCreate)) rid <- insert $ Resource aid fid <- insert Factory - { factoryResource = rid + { factoryResource = rid + , factoryAllowDeck = True + , factoryAllowProject = True + , factoryAllowTeam = True } return (fid, rid, actorFollowers a) diff --git a/src/Vervis/Migration.hs b/src/Vervis/Migration.hs index a8994db..a8b81e8 100644 --- a/src/Vervis/Migration.hs +++ b/src/Vervis/Migration.hs @@ -3926,6 +3926,12 @@ changes hLocal ctx = , removeField "Group" "create" -- 664 , removeField "Factory" "create" + -- 665 + , addFieldPrimRequired "Factory" True "allowDeck" + -- 666 + , addFieldPrimRequired "Factory" True "allowProject" + -- 667 + , addFieldPrimRequired "Factory" True "allowTeam" ] migrateDB diff --git a/th/models b/th/models index b547ddc..b754064 100644 --- a/th/models +++ b/th/models @@ -182,7 +182,10 @@ Komponent UniqueKomponent resource Factory - resource ResourceId + resource ResourceId + allowDeck Bool + allowProject Bool + allowTeam Bool UniqueFactory resource