From 8693277e88ba074479748a54e0dd3d0d770aa19f Mon Sep 17 00:00:00 2001 From: HugoCasa Date: Fri, 18 Oct 2024 18:20:13 +0200 Subject: [PATCH] support colon in job filter tags scope --- backend/windmill-api/src/users.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/backend/windmill-api/src/users.rs b/backend/windmill-api/src/users.rs index 415e8e981c959..57d191e6e8516 100644 --- a/backend/windmill-api/src/users.rs +++ b/backend/windmill-api/src/users.rs @@ -706,14 +706,17 @@ where } pub fn get_scope_tags(authed: &ApiAuthed) -> Option> { - authed - .scopes - .as_ref()? - .iter() - .find_map(|s| match s.split(":").collect::>().as_slice() { - ["if_jobs", "filter_tags", tags] => Some(tags.split(",").collect::>()), - _ => None, - }) + authed.scopes.as_ref()?.iter().find_map(|s| { + if s.starts_with("if_jobs:filter_tags:") { + Some( + s.trim_start_matches("if_jobs:filter_tags:") + .split(",") + .collect::>(), + ) + } else { + None + } + }) } #[derive(Clone, Debug)]