@ -91,19 +91,15 @@ fn sync(data: Form<SyncData>, headers: Headers, conn: DbConn) -> Json<Value> { 
				
			 
			
		
	
		
		
			
				
					 
					 
					     let   folders_json : Vec < Value >   =   folders . iter ( ) . map ( Folder ::to_json ) . collect ( ) ;  
					 
					 
					     let   folders_json : Vec < Value >   =   folders . iter ( ) . map ( Folder ::to_json ) . collect ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					     let   collections   =   Collection ::find_by_user_uuid ( & headers . user . uuid ,   & conn ) ;  
					 
					 
					     let   collections   =   Collection ::find_by_user_uuid ( & headers . user . uuid ,   & conn ) ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					     let   collections_json : Vec < Value >   =   collections  
					 
					 
					     let   collections_json : Vec < Value >   =  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					         . iter ( )  
					 
					 
					         collections . iter ( ) . map ( | c |   c . to_json_details ( & headers . user . uuid ,   & conn ) ) . collect ( ) ;  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					         . map ( | c |   c . to_json_details ( & headers . user . uuid ,   & conn ) )  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					         . collect ( ) ;  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					     let   policies   =   OrgPolicy ::find_by_user ( & headers . user . uuid ,   & conn ) ;  
					 
					 
					     let   policies   =   OrgPolicy ::find_by_user ( & headers . user . uuid ,   & conn ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					     let   policies_json : Vec < Value >   =   policies . iter ( ) . map ( OrgPolicy ::to_json ) . collect ( ) ;  
					 
					 
					     let   policies_json : Vec < Value >   =   policies . iter ( ) . map ( OrgPolicy ::to_json ) . collect ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					     let   ciphers   =   Cipher ::find_by_user_visible ( & headers . user . uuid ,   & conn ) ;  
					 
					 
					     let   ciphers   =   Cipher ::find_by_user_visible ( & headers . user . uuid ,   & conn ) ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					     let   ciphers_json : Vec < Value >   =   ciphers  
					 
					 
					     let   ciphers_json : Vec < Value >   =  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					         . iter ( )  
					 
					 
					         ciphers . iter ( ) . map ( | c |   c . to_json ( & headers . host ,   & headers . user . uuid ,   & conn ) ) . collect ( ) ;  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					         . map ( | c |   c . to_json ( & headers . host ,   & headers . user . uuid ,   & conn ) )  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					         . collect ( ) ;  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					     let   sends   =   Send ::find_by_user ( & headers . user . uuid ,   & conn ) ;  
					 
					 
					     let   sends   =   Send ::find_by_user ( & headers . user . uuid ,   & conn ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					     let   sends_json : Vec < Value >   =   sends . iter ( ) . map ( | s |   s . to_json ( ) ) . collect ( ) ;  
					 
					 
					     let   sends_json : Vec < Value >   =   sends . iter ( ) . map ( | s |   s . to_json ( ) ) . collect ( ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -130,10 +126,8 @@ fn sync(data: Form<SyncData>, headers: Headers, conn: DbConn) -> Json<Value> { 
				
			 
			
		
	
		
		
			
				
					 
					 
					fn  get_ciphers ( headers : Headers ,   conn : DbConn )   -> Json < Value >   {  
					 
					 
					fn  get_ciphers ( headers : Headers ,   conn : DbConn )   -> Json < Value >   {  
				
			 
			
		
	
		
		
			
				
					 
					 
					     let   ciphers   =   Cipher ::find_by_user_visible ( & headers . user . uuid ,   & conn ) ;  
					 
					 
					     let   ciphers   =   Cipher ::find_by_user_visible ( & headers . user . uuid ,   & conn ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					     let   ciphers_json : Vec < Value >   =   ciphers  
					 
					 
					     let   ciphers_json : Vec < Value >   =  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					         . iter ( )  
					 
					 
					         ciphers . iter ( ) . map ( | c |   c . to_json ( & headers . host ,   & headers . user . uuid ,   & conn ) ) . collect ( ) ;  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					         . map ( | c |   c . to_json ( & headers . host ,   & headers . user . uuid ,   & conn ) )  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					         . collect ( ) ;  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					     Json ( json ! ( {  
					 
					 
					     Json ( json ! ( {  
				
			 
			
		
	
		
		
			
				
					 
					 
					       "Data" : ciphers_json ,  
					 
					 
					       "Data" : ciphers_json ,  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -583,11 +577,8 @@ fn post_collections_admin( 
				
			 
			
		
	
		
		
			
				
					 
					 
					     }  
					 
					 
					     }  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					     let   posted_collections : HashSet < String >   =   data . CollectionIds . iter ( ) . cloned ( ) . collect ( ) ;  
					 
					 
					     let   posted_collections : HashSet < String >   =   data . CollectionIds . iter ( ) . cloned ( ) . collect ( ) ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					     let   current_collections : HashSet < String >   =   cipher  
					 
					 
					     let   current_collections : HashSet < String >   =  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					         . get_collections ( & headers . user . uuid ,   & conn )  
					 
					 
					         cipher . get_collections ( & headers . user . uuid ,   & conn ) . iter ( ) . cloned ( ) . collect ( ) ;  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					         . iter ( )  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					         . cloned ( )  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					         . collect ( ) ;  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					     for   collection   in   posted_collections . symmetric_difference ( & current_collections )   {  
					 
					 
					     for   collection   in   posted_collections . symmetric_difference ( & current_collections )   {  
				
			 
			
		
	
		
		
			
				
					 
					 
					         match   Collection ::find_by_uuid ( & collection ,   & conn )   {  
					 
					 
					         match   Collection ::find_by_uuid ( & collection ,   & conn )   {  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -823,13 +814,8 @@ fn post_attachment( 
				
			 
			
		
	
		
		
			
				
					 
					 
					                     let   file_name   =   HEXLOWER . encode ( & crypto ::get_random ( vec ! [ 0 ;   10 ] ) ) ;  
					 
					 
					                     let   file_name   =   HEXLOWER . encode ( & crypto ::get_random ( vec ! [ 0 ;   10 ] ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					                     let   path   =   base_path . join ( & file_name ) ;  
					 
					 
					                     let   path   =   base_path . join ( & file_name ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					                     let   size   =   match   field  
					 
					 
					                     let   size   =  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					                         . data  
					 
					 
					                         match   field . data . save ( ) . memory_threshold ( 0 ) . size_limit ( size_limit ) . with_path ( path . clone ( ) )   {  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					                         . save ( )  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					                         . memory_threshold ( 0 )  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					                         . size_limit ( size_limit )  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					                         . with_path ( path . clone ( ) )  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					                     {  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					                             SaveResult ::Full ( SavedData ::File ( _ ,   size ) )   = >   size   as   i32 ,  
					 
					 
					                             SaveResult ::Full ( SavedData ::File ( _ ,   size ) )   = >   size   as   i32 ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					                             SaveResult ::Full ( other )   = >   {  
					 
					 
					                             SaveResult ::Full ( other )   = >   {  
				
			 
			
		
	
		
		
			
				
					 
					 
					                                 std ::fs ::remove_file ( path ) . ok ( ) ;  
					 
					 
					                                 std ::fs ::remove_file ( path ) . ok ( ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -878,11 +864,7 @@ fn post_attachment_admin( 
				
			 
			
		
	
		
		
			
				
					 
					 
					     post_attachment ( uuid ,   data ,   content_type ,   headers ,   conn ,   nt )  
					 
					 
					     post_attachment ( uuid ,   data ,   content_type ,   headers ,   conn ,   nt )  
				
			 
			
		
	
		
		
			
				
					 
					 
					}  
					 
					 
					}  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					#[ post(
  
					 
					 
					#[ post( " /ciphers/<uuid>/attachment/<attachment_id>/share " , format =  " multipart/form-data " , data =  " <data> " ) ]  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					     "/ciphers/<uuid>/attachment/<attachment_id>/share" ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					     format   =   "multipart/form-data" ,  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					     data   =   "<data>"  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					) ]  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
			
				
					 
					 
					fn  post_attachment_share (  
					 
					 
					fn  post_attachment_share (  
				
			 
			
		
	
		
		
			
				
					 
					 
					     uuid : String ,  
					 
					 
					     uuid : String ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					     attachment_id : String ,  
					 
					 
					     attachment_id : String ,