From dab6033cad9bfdd47f7fb34db4a0a673a6b16f0c Mon Sep 17 00:00:00 2001 From: ppigazzini Date: Sat, 4 May 2024 13:05:16 +0200 Subject: [PATCH] Skip vtjson validation for withelisted users --- server/fishtest/api.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/server/fishtest/api.py b/server/fishtest/api.py index f82748da51..fc2ff1087a 100644 --- a/server/fishtest/api.py +++ b/server/fishtest/api.py @@ -35,6 +35,22 @@ WORKER_VERSION = 236 +def skip_validation_for_whitelisted_users(func): + whitelisted_users = ( + "user00", + "vdv", + ) + + def wrapper(self, *args, **kwargs): + username = self.request.json_body["worker_info"]["username"] + if username not in whitelisted_users: + func(self, *args, **kwargs) + else: + print(f"Skipping validation for whitelisted user: {username}", flush=True) + + return wrapper + + def validate_request(request): validate(api_schema, request, "request") @@ -119,6 +135,7 @@ def validate_username_password(self, api): exception=HTTPUnauthorized, ) + @skip_validation_for_whitelisted_users def validate_request(self, api): self.__run = None self.__task = None