diff --git a/backend/windmill-api/src/scim.rs b/backend/windmill-api/src/scim.rs index 962f93c584..89a21543b5 100644 --- a/backend/windmill-api/src/scim.rs +++ b/backend/windmill-api/src/scim.rs @@ -342,7 +342,7 @@ pub async fn get_groups( Extension(db): Extension, Query(query): Query, ) -> Result> { - let sqlb = SqlBuilder::select_from("instance_group") + let mut sqlb = SqlBuilder::select_from("instance_group") .fields(&[ "name", "external_id", @@ -357,6 +357,14 @@ pub async fn get_groups( .offset(query.startIndex.map(|x| x - 1).unwrap_or(0)) .clone(); + if let Some(filter) = query.filter { + let filter = filter + .replace("displayName", "scim_display_name") + .replace("eq", "=") + .replace("\"", "'"); + sqlb.and_where(&filter); + } + let sql = sqlb.sql().map_err(|e| Error::InternalErr(e.to_string()))?; let groups = sqlx::query_as::<_, Group>(&sql) .fetch_all(&db)