Browse Source
Require a collection when adding a cipher to an organization
pull/991/head
theycallmesteve
5 years ago
No known key found for this signature in database
GPG Key ID: 6240923F65CC698D
1 changed files with
5 additions and
0 deletions
-
src/api/core/ciphers.rs
|
|
@ -208,6 +208,11 @@ fn post_ciphers_admin(data: JsonUpcase<ShareCipherData>, headers: Headers, conn: |
|
|
|
fn _post_ciphers_admin(data: JsonUpcase<ShareCipherData>, headers: Headers, conn: DbConn, nt: Notify, resp_model: &str) -> JsonResult { |
|
|
|
let data: ShareCipherData = data.into_inner().data; |
|
|
|
|
|
|
|
// Require a collection, otherwise it will be saved as "Unassigned" without regard to read_only
|
|
|
|
if data.CollectionIds.is_empty() { |
|
|
|
err!("You must select at least one collection.") |
|
|
|
} |
|
|
|
|
|
|
|
let mut cipher = Cipher::new(data.Cipher.Type, data.Cipher.Name.clone()); |
|
|
|
cipher.user_uuid = Some(headers.user.uuid.clone()); |
|
|
|
cipher.save(&conn)?; |
|
|
|