Skip to content

Commit

Permalink
Skip vtjson validation for withelisted users
Browse files Browse the repository at this point in the history
  • Loading branch information
ppigazzini committed May 4, 2024
1 parent 2737c82 commit dab6033
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions server/fishtest/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dab6033

Please sign in to comment.