From 68de94c5c78a0194ba19397136a0fe71a6a5ad13 Mon Sep 17 00:00:00 2001 From: db0 Date: Thu, 22 Jun 2023 16:42:42 +0200 Subject: [PATCH] feat: max 20 guarantees --- overseer/apis/v1/guarantees.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/overseer/apis/v1/guarantees.py b/overseer/apis/v1/guarantees.py index daffa16..c41b764 100644 --- a/overseer/apis/v1/guarantees.py +++ b/overseer/apis/v1/guarantees.py @@ -76,6 +76,8 @@ class Guarantees(Resource): raise e.NotFound(f"No Instance found matching provided API key and domain. Have you remembered to register it?") if len(instance.guarantors) == 0: raise e.Forbidden("Only guaranteed instances can guarantee others.") + if len(instance.guarantors) >= 20 and instance.id != 0: + raise e.Forbidden("You cannot guarantee for more than 20 instances") unbroken_chain, chainbreaker = database.has_unbroken_chain(instance.id) if not unbroken_chain: raise e.Forbidden(f"Guarantee chain for this instance has been broken. Chain ends at {chainbreaker.domain}!")