From d4a2dbc47f8bcab751563f9ce63c2ae5f70d4396 Mon Sep 17 00:00:00 2001 From: Ignacio Heredia Date: Wed, 6 Nov 2024 13:53:52 +0100 Subject: [PATCH] fix: handle case where user does not belong to VO supported by the project --- ai4papi/routers/v1/deployments/tools.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ai4papi/routers/v1/deployments/tools.py b/ai4papi/routers/v1/deployments/tools.py index 0fb87ba..82a16a0 100644 --- a/ai4papi/routers/v1/deployments/tools.py +++ b/ai4papi/routers/v1/deployments/tools.py @@ -43,11 +43,10 @@ def get_deployments( auth_info = auth.get_user_info(token=authorization.credentials) # If no VOs, then retrieve jobs from all user VOs - # Else only retrieve from allowed VOs + # Always remove VOs that do not belong to the project if not vos: vos = auth_info['vos'] - else: - vos = set(vos).intersection(auth_info['vos']) + vos = set(vos).intersection(set(papiconf.MAIN_CONF['auth']['VO'])) if not vos: raise HTTPException( status_code=401, @@ -201,7 +200,7 @@ def create_deployment( priority = 50 base_domain = papiconf.MAIN_CONF['lb']['domain'][vo] - + # Create a default secret for the Federated Server _ = ai4secrets.create_secret( vo=vo,