diff options
author | Daniel García <[email protected]> | 2024-06-19 17:29:40 +0200 |
---|---|---|
committer | Daniel García <[email protected]> | 2024-06-19 17:29:40 +0200 |
commit | b4c95189b834fa708d42d9378129ba596131fb4a (patch) | |
tree | 7c8294388a04513694281564d643c9cb8d10f304 | |
parent | b46a6e932c60318af4c1a4c59649e905681551bc (diff) | |
download | vaultwarden-b4c95189b834fa708d42d9378129ba596131fb4a.tar.gz vaultwarden-b4c95189b834fa708d42d9378129ba596131fb4a.zip |
Update org revoke
-rw-r--r-- | src/api/core/organizations.rs | 15 |
1 files 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/<org_id>/users/deactivate", data = "<data>")] async fn bulk_deactivate_organization_user( org_id: &str, - data: Json<Value>, + data: Json<OrgBulkRevokeData>, headers: AdminHeaders, conn: DbConn, ) -> Json<Value> { @@ -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<Vec<String>>, +} + #[put("/organizations/<org_id>/users/revoke", data = "<data>")] async fn bulk_revoke_organization_user( org_id: &str, - data: Json<Value>, + data: Json<OrgBulkRevokeData>, headers: AdminHeaders, mut conn: DbConn, ) -> Json<Value> { 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:?}"), }; |