mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-11 08:07:15 +00:00
fix(sso): improve handling of filters for get groups for sso
This commit is contained in:
@@ -342,7 +342,7 @@ pub async fn get_groups(
|
||||
Extension(db): Extension<DB>,
|
||||
Query(query): Query<ScimQuery>,
|
||||
) -> Result<JsonScim<serde_json::Value>> {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user