Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2024-11-22 05:10:29 +01:00
Allow no folder when editing cipher
Dieser Commit ist enthalten in:
Ursprung
328cbade19
Commit
e6b6d7f3a0
1 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen
|
@ -112,9 +112,9 @@ fn post_ciphers(data: Json<CipherData>, headers: Headers, conn: DbConn) -> JsonR
|
||||||
Ok(Json(cipher.to_json(&headers.host, &conn)))
|
Ok(Json(cipher.to_json(&headers.host, &conn)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_cipher_from_data(cipher: &mut Cipher, data: CipherData, headers: &Headers, conn: &DbConn) -> EmptyResult {
|
fn update_cipher_from_data(cipher: &mut Cipher, data: CipherData, headers: &Headers, conn: &DbConn) -> EmptyResult {
|
||||||
if let Some(folder_id) = data.folderId {
|
if let Some(ref folder_id) = data.folderId {
|
||||||
match Folder::find_by_uuid(&folder_id, conn) {
|
match Folder::find_by_uuid(folder_id, conn) {
|
||||||
Some(folder) => {
|
Some(folder) => {
|
||||||
if folder.user_uuid != headers.user.uuid {
|
if folder.user_uuid != headers.user.uuid {
|
||||||
err!("Folder is not owned by user")
|
err!("Folder is not owned by user")
|
||||||
|
@ -122,10 +122,10 @@ fn update_cipher_from_data(cipher: &mut Cipher, data: CipherData, headers: &Head
|
||||||
}
|
}
|
||||||
None => err!("Folder doesn't exist")
|
None => err!("Folder doesn't exist")
|
||||||
}
|
}
|
||||||
|
|
||||||
cipher.folder_uuid = Some(folder_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cipher.folder_uuid = data.folderId;
|
||||||
|
|
||||||
if let org_id @ Some(_) = data.organizationId {
|
if let org_id @ Some(_) = data.organizationId {
|
||||||
// TODO: Check if user in org
|
// TODO: Check if user in org
|
||||||
cipher.organization_uuid = org_id;
|
cipher.organization_uuid = org_id;
|
||||||
|
|
Laden …
In neuem Issue referenzieren