mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-06-12 13:50:07 +00:00
Fix attachments during key rotation, add individual attachment key
This commit is contained in:
parent
f71f10eac6
commit
6364c05789
6 changed files with 89 additions and 35 deletions
|
@ -12,6 +12,7 @@ pub struct Attachment {
|
|||
pub cipher_uuid: String,
|
||||
pub file_name: String,
|
||||
pub file_size: i32,
|
||||
pub key: Option<String>
|
||||
}
|
||||
|
||||
/// Local methods
|
||||
|
@ -22,6 +23,7 @@ impl Attachment {
|
|||
cipher_uuid,
|
||||
file_name,
|
||||
file_size,
|
||||
key: None
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +43,7 @@ impl Attachment {
|
|||
"FileName": self.file_name,
|
||||
"Size": self.file_size.to_string(),
|
||||
"SizeName": display_size,
|
||||
"Key": self.key,
|
||||
"Object": "attachment"
|
||||
})
|
||||
}
|
||||
|
@ -92,8 +95,8 @@ impl Attachment {
|
|||
}
|
||||
|
||||
pub fn delete_all_by_cipher(cipher_uuid: &str, conn: &DbConn) -> QueryResult<()> {
|
||||
for attachement in Attachment::find_by_cipher(&cipher_uuid, &conn) {
|
||||
attachement.delete(&conn)?;
|
||||
for attachment in Attachment::find_by_cipher(&cipher_uuid, &conn) {
|
||||
attachment.delete(&conn)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -71,7 +71,6 @@ impl Device {
|
|||
let time_now = Utc::now().naive_utc();
|
||||
self.updated_at = time_now;
|
||||
|
||||
|
||||
let orgowner: Vec<_> = orgs.iter().filter(|o| o.type_ == 0).map(|o| o.org_uuid.clone()).collect();
|
||||
let orgadmin: Vec<_> = orgs.iter().filter(|o| o.type_ == 1).map(|o| o.org_uuid.clone()).collect();
|
||||
let orguser: Vec<_> = orgs.iter().filter(|o| o.type_ == 2).map(|o| o.org_uuid.clone()).collect();
|
||||
|
|
|
@ -4,6 +4,7 @@ table! {
|
|||
cipher_uuid -> Text,
|
||||
file_name -> Text,
|
||||
file_size -> Integer,
|
||||
key -> Nullable<Text>,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue