Daniel García
					
					6 years ago
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: FC8A7D14C3CD543A
						
					
				
			
		
		
		
	
		
			
				 1 changed files with 
17 additions and 
14 deletions
			 
			
		 
		
			
				- 
					
					
					 
					src/api/core/ciphers.rs
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -603,12 +603,14 @@ fn share_cipher_by_uuid( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        None => err!("Cipher doesn't exist"), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    }; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    let mut shared_to_collection = false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    match data.Cipher.OrganizationId.clone() { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // If we don't get an organization ID, we don't do anything
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // No error because this is used when using the Clone functionality
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        None => Ok(Json(cipher.to_json(&headers.host, &headers.user.uuid, &conn))), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        None => {}, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Some(organization_uuid) => { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            let mut shared_to_collection = false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            for uuid in &data.CollectionIds { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                match Collection::find_by_uuid_and_org(uuid, &organization_uuid, &conn) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    None => err!("Invalid collection ID provided"), | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -622,6 +624,9 @@ fn share_cipher_by_uuid( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    }; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    update_cipher_from_data( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        &mut cipher, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        data.Cipher, | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -633,8 +638,6 @@ fn share_cipher_by_uuid( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    )?; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    Ok(Json(cipher.to_json(&headers.host, &headers.user.uuid, &conn))) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					#[post("/ciphers/<uuid>/attachment", format = "multipart/form-data", data = "<data>")] | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |