From b4c95189b834fa708d42d9378129ba596131fb4a Mon Sep 17 00:00:00 2001 From: Daniel GarcĂ­a Date: Wed, 19 Jun 2024 17:29:40 +0200 Subject: Update org revoke --- src/api/core/organizations.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs index 0708f91c..13fc4961 100644 --- a/src/api/core/organizations.rs +++ b/src/api/core/organizations.rs @@ -1978,7 +1978,7 @@ async fn deactivate_organization_user( #[put("/organizations//users/deactivate", data = "")] async fn bulk_deactivate_organization_user( org_id: &str, - data: Json, + data: Json, headers: AdminHeaders, conn: DbConn, ) -> Json { @@ -1995,21 +1995,26 @@ async fn revoke_organization_user( _revoke_organization_user(org_id, org_user_id, &headers, &mut conn).await } +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +struct OrgBulkRevokeData { + ids: Option>, +} + #[put("/organizations//users/revoke", data = "")] async fn bulk_revoke_organization_user( org_id: &str, - data: Json, + data: Json, headers: AdminHeaders, mut conn: DbConn, ) -> Json { let data = data.into_inner(); let mut bulk_response = Vec::new(); - match data["Ids"].as_array() { + match data.ids { Some(org_users) => { for org_user_id in org_users { - let org_user_id = org_user_id.as_str().unwrap_or_default(); - let err_msg = match _revoke_organization_user(org_id, org_user_id, &headers, &mut conn).await { + let err_msg = match _revoke_organization_user(org_id, &org_user_id, &headers, &mut conn).await { Ok(_) => String::new(), Err(e) => format!("{e:?}"), }; -- cgit v1.2.3