From a78d997cd241d5dd021f0db5fa19297cc86cf19c Mon Sep 17 00:00:00 2001 From: Florian Amsallem Date: Thu, 6 Mar 2025 15:58:11 +0100 Subject: [PATCH] editoast: fix authz for search endpoint operationalpoint Signed-off-by: Florian Amsallem --- editoast/src/views/search.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/editoast/src/views/search.rs b/editoast/src/views/search.rs index 6e54c36057c..21006b77307 100644 --- a/editoast/src/views/search.rs +++ b/editoast/src/views/search.rs @@ -351,9 +351,12 @@ async fn search( Json(SearchPayload { object, query, dry }): Json, ) -> Result> { let roles: HashSet = match object.as_str() { - "track" | "operationalpoint" | "signal" => HashSet::from([BuiltinRole::OperationalStudies]), - "trainschedule" => HashSet::from([BuiltinRole::OperationalStudies, BuiltinRole::Stdcm]), - "project" | "study" | "scenario" => HashSet::from([BuiltinRole::OperationalStudies]), + "track" | "signal" | "project" | "study" | "scenario" => { + HashSet::from([BuiltinRole::OperationalStudies]) + } + "trainschedule" | "operationalpoint" => { + HashSet::from([BuiltinRole::OperationalStudies, BuiltinRole::Stdcm]) + } _ => { return Err(SearchApiError::ObjectType { object_type: object.to_owned(),