Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2025-01-07 11:45:40 +01:00
add to_json_details_for_group
Dieser Commit ist enthalten in:
Ursprung
6517bbab9b
Commit
23ef84d5e5
2 geänderte Dateien mit 11 neuen und 28 gelöschten Zeilen
|
@ -366,9 +366,7 @@ async fn get_org_collections_details(
|
|||
CollectionGroup::find_by_collection(&col.uuid, &mut conn)
|
||||
.await
|
||||
.iter()
|
||||
.map(|collection_group| {
|
||||
GroupSelection::to_collection_group_details_read_only(collection_group).to_json()
|
||||
})
|
||||
.map(|collection_group| collection_group.to_json_details_for_group())
|
||||
.collect()
|
||||
} else {
|
||||
Vec::with_capacity(0)
|
||||
|
@ -650,9 +648,7 @@ async fn get_org_collection_detail(
|
|||
CollectionGroup::find_by_collection(&collection.uuid, &mut conn)
|
||||
.await
|
||||
.iter()
|
||||
.map(|collection_group| {
|
||||
GroupSelection::to_collection_group_details_read_only(collection_group).to_json()
|
||||
})
|
||||
.map(|collection_group| collection_group.to_json_details_for_group())
|
||||
.collect()
|
||||
} else {
|
||||
// The Bitwarden clients seem to call this API regardless of whether groups are enabled,
|
||||
|
@ -2377,28 +2373,6 @@ impl GroupRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct GroupSelection {
|
||||
id: GroupId,
|
||||
read_only: bool,
|
||||
hide_passwords: bool,
|
||||
}
|
||||
|
||||
impl GroupSelection {
|
||||
pub fn to_collection_group_details_read_only(collection_group: &CollectionGroup) -> Self {
|
||||
Self {
|
||||
id: collection_group.groups_uuid.clone(),
|
||||
read_only: collection_group.read_only,
|
||||
hide_passwords: collection_group.hide_passwords,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_json(&self) -> Value {
|
||||
json!(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct CollectionSelection {
|
||||
|
|
|
@ -127,6 +127,15 @@ impl CollectionGroup {
|
|||
hide_passwords,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_json_details_for_group(&self) -> Value {
|
||||
json!({
|
||||
"id": self.groups_uuid,
|
||||
"readOnly": self.read_only,
|
||||
"hidePasswords": self.hide_passwords,
|
||||
"manage": false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl GroupUser {
|
||||
|
|
Laden …
In neuem Issue referenzieren