@ -11,7 +11,7 @@ use serde_json::Value; 
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					use   crate ::{ use   crate ::{  
			
		
	
		
		
			
				
					     api ::{ self ,   core ::log_event ,   EmptyResult ,   JsonResult ,   JsonUpcase ,   Notify ,   PasswordData ,   UpdateType } ,      api ::{ self ,   core ::log_event ,   EmptyResult ,   JsonResult ,   JsonUpcase ,   Notify ,   PasswordData ,   UpdateType } ,  
			
		
	
		
		
			
				
					
					     auth ::{ ClientIp ,   Headers } ,      auth ::Headers ,  
			
				
				
			
		
	
		
		
	
		
		
			
				
					     crypto ,      crypto ,  
			
		
	
		
		
			
				
					     db ::{ models ::* ,   DbConn ,   DbPool } ,      db ::{ models ::* ,   DbConn ,   DbPool } ,  
			
		
	
		
		
			
				
					     CONFIG ,      CONFIG ,  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -263,10 +263,9 @@ async fn post_ciphers_admin( 
			
		
	
		
		
			
				
					     data : JsonUpcase < ShareCipherData > ,      data : JsonUpcase < ShareCipherData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					
					     post_ciphers_create ( data ,   headers ,   conn ,   ip ,   nt ) . await      post_ciphers_create ( data ,   headers ,   conn ,   nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					/// Called when creating a new org-owned cipher, or cloning a cipher (whether
 /// Called when creating a new org-owned cipher, or cloning a cipher (whether
  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -277,7 +276,6 @@ async fn post_ciphers_create( 
			
		
	
		
		
			
				
					     data : JsonUpcase < ShareCipherData > ,      data : JsonUpcase < ShareCipherData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					     let   mut   data : ShareCipherData   =   data . into_inner ( ) . data ;      let   mut   data : ShareCipherData   =   data . into_inner ( ) . data ;  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -305,18 +303,12 @@ async fn post_ciphers_create( 
			
		
	
		
		
			
				
					     // or otherwise), we can just ignore this field entirely.
      // or otherwise), we can just ignore this field entirely.
  
			
		
	
		
		
			
				
					     data . Cipher . LastKnownRevisionDate   =   None ;      data . Cipher . LastKnownRevisionDate   =   None ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					
					     share_cipher_by_uuid ( & cipher . uuid ,   data ,   & headers ,   & mut   conn ,   & ip ,   & nt ) . await      share_cipher_by_uuid ( & cipher . uuid ,   data ,   & headers ,   & mut   conn ,   & nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					/// Called when creating a new user-owned cipher.
 /// Called when creating a new user-owned cipher.
  
			
		
	
		
		
			
				
					#[ post( " /ciphers " , data =  " <data> " ) ] #[ post( " /ciphers " , data =  " <data> " ) ]  
			
		
	
		
		
			
				
					
					async   fn  post_ciphers ( async   fn  post_ciphers ( data : JsonUpcase < CipherData > ,   headers : Headers ,   mut   conn : DbConn ,   nt : Notify < '_ > )   -> JsonResult   {  
			
				
				
			
		
	
		
		
			
				
					     data : JsonUpcase < CipherData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   {  
			
		
	
		
		
	
		
		
			
				
					     let   mut   data : CipherData   =   data . into_inner ( ) . data ;      let   mut   data : CipherData   =   data . into_inner ( ) . data ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     // The web/browser clients set this field to null as expected, but the
      // The web/browser clients set this field to null as expected, but the
  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -326,8 +318,7 @@ async fn post_ciphers( 
			
		
	
		
		
			
				
					     data . LastKnownRevisionDate   =   None ;      data . LastKnownRevisionDate   =   None ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     let   mut   cipher   =   Cipher ::new ( data . Type ,   data . Name . clone ( ) ) ;      let   mut   cipher   =   Cipher ::new ( data . Type ,   data . Name . clone ( ) ) ;  
			
		
	
		
		
			
				
					
					     update_cipher_from_data ( & mut   cipher ,   data ,   & headers ,   false ,   & mut   conn ,   & ip ,   & nt ,   UpdateType ::SyncCipherCreate )      update_cipher_from_data ( & mut   cipher ,   data ,   & headers ,   false ,   & mut   conn ,   & nt ,   UpdateType ::SyncCipherCreate ) . await ? ;  
			
				
				
			
		
	
		
		
			
				
					         . await ? ;  
			
		
	
		
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     Ok ( Json ( cipher . to_json ( & headers . host ,   & headers . user . uuid ,   None ,   CipherSyncType ::User ,   & mut   conn ) . await ) )      Ok ( Json ( cipher . to_json ( & headers . host ,   & headers . user . uuid ,   None ,   CipherSyncType ::User ,   & mut   conn ) . await ) )  
			
		
	
		
		
			
				
					} }  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -354,14 +345,12 @@ async fn enforce_personal_ownership_policy( 
			
		
	
		
		
			
				
					     Ok ( ( ) )      Ok ( ( ) )  
			
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ allow(clippy::too_many_arguments) ]  
			
		
	
		
		
			
				
					pub   async   fn  update_cipher_from_data ( pub   async   fn  update_cipher_from_data (  
			
		
	
		
		
			
				
					     cipher : & mut   Cipher ,      cipher : & mut   Cipher ,  
			
		
	
		
		
			
				
					     data : CipherData ,      data : CipherData ,  
			
		
	
		
		
			
				
					     headers : & Headers ,      headers : & Headers ,  
			
		
	
		
		
			
				
					     shared_to_collection : bool ,      shared_to_collection : bool ,  
			
		
	
		
		
			
				
					     conn : & mut   DbConn ,      conn : & mut   DbConn ,  
			
		
	
		
		
			
				
					     ip : & ClientIp ,  
			
		
	
		
		
			
				
					     nt : & Notify < '_ > ,      nt : & Notify < '_ > ,  
			
		
	
		
		
			
				
					     ut : UpdateType ,      ut : UpdateType ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -517,7 +506,7 @@ pub async fn update_cipher_from_data( 
			
		
	
		
		
			
				
					                 String ::from ( org_uuid ) ,                  String ::from ( org_uuid ) ,  
			
		
	
		
		
			
				
					                 headers . user . uuid . clone ( ) ,                  headers . user . uuid . clone ( ) ,  
			
		
	
		
		
			
				
					                 headers . device . atype ,                  headers . device . atype ,  
			
		
	
		
		
			
				
					
					                 & ip . ip ,                  & headers . ip . ip ,  
			
				
				
			
		
	
		
		
	
		
		
			
				
					                 conn ,                  conn ,  
			
		
	
		
		
			
				
					             )              )  
			
		
	
		
		
			
				
					             . await ;              . await ;  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -551,7 +540,6 @@ async fn post_ciphers_import( 
			
		
	
		
		
			
				
					     data : JsonUpcase < ImportData > ,      data : JsonUpcase < ImportData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					     enforce_personal_ownership_policy ( None ,   & headers ,   & mut   conn ) . await ? ;      enforce_personal_ownership_policy ( None ,   & headers ,   & mut   conn ) . await ? ;  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -586,8 +574,7 @@ async fn post_ciphers_import( 
			
		
	
		
		
			
				
					         cipher_data . FolderId   =   folder_uuid ;          cipher_data . FolderId   =   folder_uuid ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					         let   mut   cipher   =   Cipher ::new ( cipher_data . Type ,   cipher_data . Name . clone ( ) ) ;          let   mut   cipher   =   Cipher ::new ( cipher_data . Type ,   cipher_data . Name . clone ( ) ) ;  
			
		
	
		
		
			
				
					
					         update_cipher_from_data ( & mut   cipher ,   cipher_data ,   & headers ,   false ,   & mut   conn ,   & ip ,   & nt ,   UpdateType ::None )          update_cipher_from_data ( & mut   cipher ,   cipher_data ,   & headers ,   false ,   & mut   conn ,   & nt ,   UpdateType ::None ) . await ? ;  
			
				
				
			
		
	
		
		
			
				
					             . await ? ;  
			
		
	
		
		
	
		
		
			
				
					     }      }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     let   mut   user   =   headers . user ;      let   mut   user   =   headers . user ;  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -603,10 +590,9 @@ async fn put_cipher_admin( 
			
		
	
		
		
			
				
					     data : JsonUpcase < CipherData > ,      data : JsonUpcase < CipherData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					
					     put_cipher ( uuid ,   data ,   headers ,   conn ,   ip ,   nt ) . await      put_cipher ( uuid ,   data ,   headers ,   conn ,   nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ post( " /ciphers/<uuid>/admin " , data =  " <data> " ) ] #[ post( " /ciphers/<uuid>/admin " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -615,10 +601,9 @@ async fn post_cipher_admin( 
			
		
	
		
		
			
				
					     data : JsonUpcase < CipherData > ,      data : JsonUpcase < CipherData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					
					     post_cipher ( uuid ,   data ,   headers ,   conn ,   ip ,   nt ) . await      post_cipher ( uuid ,   data ,   headers ,   conn ,   nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ post( " /ciphers/<uuid> " , data =  " <data> " ) ] #[ post( " /ciphers/<uuid> " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -627,10 +612,9 @@ async fn post_cipher( 
			
		
	
		
		
			
				
					     data : JsonUpcase < CipherData > ,      data : JsonUpcase < CipherData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					
					     put_cipher ( uuid ,   data ,   headers ,   conn ,   ip ,   nt ) . await      put_cipher ( uuid ,   data ,   headers ,   conn ,   nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ put( " /ciphers/<uuid> " , data =  " <data> " ) ] #[ put( " /ciphers/<uuid> " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -639,7 +623,6 @@ async fn put_cipher( 
			
		
	
		
		
			
				
					     data : JsonUpcase < CipherData > ,      data : JsonUpcase < CipherData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					     let   data : CipherData   =   data . into_inner ( ) . data ;      let   data : CipherData   =   data . into_inner ( ) . data ;  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -658,8 +641,7 @@ async fn put_cipher( 
			
		
	
		
		
			
				
					         err ! ( "Cipher is not write accessible" )          err ! ( "Cipher is not write accessible" )  
			
		
	
		
		
			
				
					     }      }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					
					     update_cipher_from_data ( & mut   cipher ,   data ,   & headers ,   false ,   & mut   conn ,   & ip ,   & nt ,   UpdateType ::SyncCipherUpdate )      update_cipher_from_data ( & mut   cipher ,   data ,   & headers ,   false ,   & mut   conn ,   & nt ,   UpdateType ::SyncCipherUpdate ) . await ? ;  
			
				
				
			
		
	
		
		
			
				
					         . await ? ;  
			
		
	
		
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     Ok ( Json ( cipher . to_json ( & headers . host ,   & headers . user . uuid ,   None ,   CipherSyncType ::User ,   & mut   conn ) . await ) )      Ok ( Json ( cipher . to_json ( & headers . host ,   & headers . user . uuid ,   None ,   CipherSyncType ::User ,   & mut   conn ) . await ) )  
			
		
	
		
		
			
				
					} }  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -720,9 +702,8 @@ async fn put_collections_update( 
			
		
	
		
		
			
				
					     data : JsonUpcase < CollectionsAdminData > ,      data : JsonUpcase < CollectionsAdminData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     post_collections_admin ( uuid ,   data ,   headers ,   conn ,   ip ) . await      post_collections_admin ( uuid ,   data ,   headers ,   conn ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ post( " /ciphers/<uuid>/collections " , data =  " <data> " ) ] #[ post( " /ciphers/<uuid>/collections " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -731,9 +712,8 @@ async fn post_collections_update( 
			
		
	
		
		
			
				
					     data : JsonUpcase < CollectionsAdminData > ,      data : JsonUpcase < CollectionsAdminData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     post_collections_admin ( uuid ,   data ,   headers ,   conn ,   ip ) . await      post_collections_admin ( uuid ,   data ,   headers ,   conn ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ put( " /ciphers/<uuid>/collections-admin " , data =  " <data> " ) ] #[ put( " /ciphers/<uuid>/collections-admin " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -742,9 +722,8 @@ async fn put_collections_admin( 
			
		
	
		
		
			
				
					     data : JsonUpcase < CollectionsAdminData > ,      data : JsonUpcase < CollectionsAdminData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     post_collections_admin ( uuid ,   data ,   headers ,   conn ,   ip ) . await      post_collections_admin ( uuid ,   data ,   headers ,   conn ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ post( " /ciphers/<uuid>/collections-admin " , data =  " <data> " ) ] #[ post( " /ciphers/<uuid>/collections-admin " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -753,7 +732,6 @@ async fn post_collections_admin( 
			
		
	
		
		
			
				
					     data : JsonUpcase < CollectionsAdminData > ,      data : JsonUpcase < CollectionsAdminData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					     let   data : CollectionsAdminData   =   data . into_inner ( ) . data ;      let   data : CollectionsAdminData   =   data . into_inner ( ) . data ;  
			
		
	
		
		
			
				
					
 
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -795,7 +773,7 @@ async fn post_collections_admin( 
			
		
	
		
		
			
				
					         cipher . organization_uuid . unwrap ( ) ,          cipher . organization_uuid . unwrap ( ) ,  
			
		
	
		
		
			
				
					         headers . user . uuid . clone ( ) ,          headers . user . uuid . clone ( ) ,  
			
		
	
		
		
			
				
					         headers . device . atype ,          headers . device . atype ,  
			
		
	
		
		
			
				
					
					         & ip . ip ,          & headers . ip . ip ,  
			
				
				
			
		
	
		
		
	
		
		
			
				
					         & mut   conn ,          & mut   conn ,  
			
		
	
		
		
			
				
					     )      )  
			
		
	
		
		
			
				
					     . await ;      . await ;  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -816,12 +794,11 @@ async fn post_cipher_share( 
			
		
	
		
		
			
				
					     data : JsonUpcase < ShareCipherData > ,      data : JsonUpcase < ShareCipherData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					     let   data : ShareCipherData   =   data . into_inner ( ) . data ;      let   data : ShareCipherData   =   data . into_inner ( ) . data ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					
					     share_cipher_by_uuid ( & uuid ,   data ,   & headers ,   & mut   conn ,   & ip ,   & nt ) . await      share_cipher_by_uuid ( & uuid ,   data ,   & headers ,   & mut   conn ,   & nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ put( " /ciphers/<uuid>/share " , data =  " <data> " ) ] #[ put( " /ciphers/<uuid>/share " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -830,12 +807,11 @@ async fn put_cipher_share( 
			
		
	
		
		
			
				
					     data : JsonUpcase < ShareCipherData > ,      data : JsonUpcase < ShareCipherData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					     let   data : ShareCipherData   =   data . into_inner ( ) . data ;      let   data : ShareCipherData   =   data . into_inner ( ) . data ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					
					     share_cipher_by_uuid ( & uuid ,   data ,   & headers ,   & mut   conn ,   & ip ,   & nt ) . await      share_cipher_by_uuid ( & uuid ,   data ,   & headers ,   & mut   conn ,   & nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ derive(Deserialize) ] #[ derive(Deserialize) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -850,7 +826,6 @@ async fn put_cipher_share_selected( 
			
		
	
		
		
			
				
					     data : JsonUpcase < ShareSelectedCipherData > ,      data : JsonUpcase < ShareSelectedCipherData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					     let   mut   data : ShareSelectedCipherData   =   data . into_inner ( ) . data ;      let   mut   data : ShareSelectedCipherData   =   data . into_inner ( ) . data ;  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -878,7 +853,7 @@ async fn put_cipher_share_selected( 
			
		
	
		
		
			
				
					         } ;          } ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					         match   shared_cipher_data . Cipher . Id . take ( )   {          match   shared_cipher_data . Cipher . Id . take ( )   {  
			
		
	
		
		
			
				
					
					             Some ( id )   = >   share_cipher_by_uuid ( & id ,   shared_cipher_data ,   & headers ,   & mut   conn ,   & ip ,   & nt ) . await ? ,              Some ( id )   = >   share_cipher_by_uuid ( & id ,   shared_cipher_data ,   & headers ,   & mut   conn ,   & nt ) . await ? ,  
			
				
				
			
		
	
		
		
	
		
		
			
				
					             None   = >   err ! ( "Request missing ids field" ) ,              None   = >   err ! ( "Request missing ids field" ) ,  
			
		
	
		
		
			
				
					         } ;          } ;  
			
		
	
		
		
			
				
					     }      }  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -891,7 +866,6 @@ async fn share_cipher_by_uuid( 
			
		
	
		
		
			
				
					     data : ShareCipherData ,      data : ShareCipherData ,  
			
		
	
		
		
			
				
					     headers : & Headers ,      headers : & Headers ,  
			
		
	
		
		
			
				
					     conn : & mut   DbConn ,      conn : & mut   DbConn ,  
			
		
	
		
		
			
				
					     ip : & ClientIp ,  
			
		
	
		
		
			
				
					     nt : & Notify < '_ > ,      nt : & Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					     let   mut   cipher   =   match   Cipher ::find_by_uuid ( uuid ,   conn ) . await   {      let   mut   cipher   =   match   Cipher ::find_by_uuid ( uuid ,   conn ) . await   {  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -930,7 +904,7 @@ async fn share_cipher_by_uuid( 
			
		
	
		
		
			
				
					         UpdateType ::SyncCipherCreate          UpdateType ::SyncCipherCreate  
			
		
	
		
		
			
				
					     } ;      } ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					
					     update_cipher_from_data ( & mut   cipher ,   data . Cipher ,   headers ,   shared_to_collection ,   conn ,   ip ,   nt ,   ut ) . await ? ;      update_cipher_from_data ( & mut   cipher ,   data . Cipher ,   headers ,   shared_to_collection ,   conn ,   nt ,   ut ) . await ? ;  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     Ok ( Json ( cipher . to_json ( & headers . host ,   & headers . user . uuid ,   None ,   CipherSyncType ::User ,   conn ) . await ) )      Ok ( Json ( cipher . to_json ( & headers . host ,   & headers . user . uuid ,   None ,   CipherSyncType ::User ,   conn ) . await ) )  
			
		
	
		
		
			
				
					} }  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -1025,7 +999,6 @@ async fn save_attachment( 
			
		
	
		
		
			
				
					     data : Form < UploadData < '_ > > ,      data : Form < UploadData < '_ > > ,  
			
		
	
		
		
			
				
					     headers : & Headers ,      headers : & Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> Result < ( Cipher ,   DbConn ) ,   crate ::error ::Error >   { )   -> Result < ( Cipher ,   DbConn ) ,   crate ::error ::Error >   {  
			
		
	
		
		
			
				
					     let   cipher   =   match   Cipher ::find_by_uuid ( & cipher_uuid ,   & mut   conn ) . await   {      let   cipher   =   match   Cipher ::find_by_uuid ( & cipher_uuid ,   & mut   conn ) . await   {  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -1144,7 +1117,7 @@ async fn save_attachment( 
			
		
	
		
		
			
				
					             String ::from ( org_uuid ) ,              String ::from ( org_uuid ) ,  
			
		
	
		
		
			
				
					             headers . user . uuid . clone ( ) ,              headers . user . uuid . clone ( ) ,  
			
		
	
		
		
			
				
					             headers . device . atype ,              headers . device . atype ,  
			
		
	
		
		
			
				
					
					             & ip . ip ,              & headers . ip . ip ,  
			
				
				
			
		
	
		
		
	
		
		
			
				
					             & mut   conn ,              & mut   conn ,  
			
		
	
		
		
			
				
					         )          )  
			
		
	
		
		
			
				
					         . await ;          . await ;  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1164,7 +1137,6 @@ async fn post_attachment_v2_data( 
			
		
	
		
		
			
				
					     data : Form < UploadData < '_ > > ,      data : Form < UploadData < '_ > > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					     let   attachment   =   match   Attachment ::find_by_id ( & attachment_id ,   & mut   conn ) . await   {      let   attachment   =   match   Attachment ::find_by_id ( & attachment_id ,   & mut   conn ) . await   {  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1173,7 +1145,7 @@ async fn post_attachment_v2_data( 
			
		
	
		
		
			
				
					         None   = >   err ! ( "Attachment doesn't exist" ) ,          None   = >   err ! ( "Attachment doesn't exist" ) ,  
			
		
	
		
		
			
				
					     } ;      } ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					
					     save_attachment ( attachment ,   uuid ,   data ,   & headers ,   conn ,   ip ,   nt ) . await ? ;      save_attachment ( attachment ,   uuid ,   data ,   & headers ,   conn ,   nt ) . await ? ;  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     Ok ( ( ) )      Ok ( ( ) )  
			
		
	
		
		
			
				
					} }  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1185,14 +1157,13 @@ async fn post_attachment( 
			
		
	
		
		
			
				
					     data : Form < UploadData < '_ > > ,      data : Form < UploadData < '_ > > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					     // Setting this as None signifies to save_attachment() that it should create
      // Setting this as None signifies to save_attachment() that it should create
  
			
		
	
		
		
			
				
					     // the attachment database record as well as saving the data to disk.
      // the attachment database record as well as saving the data to disk.
  
			
		
	
		
		
			
				
					     let   attachment   =   None ;      let   attachment   =   None ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					
					     let   ( cipher ,   mut   conn )   =   save_attachment ( attachment ,   uuid ,   data ,   & headers ,   conn ,   ip ,   nt ) . await ? ;      let   ( cipher ,   mut   conn )   =   save_attachment ( attachment ,   uuid ,   data ,   & headers ,   conn ,   nt ) . await ? ;  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     Ok ( Json ( cipher . to_json ( & headers . host ,   & headers . user . uuid ,   None ,   CipherSyncType ::User ,   & mut   conn ) . await ) )      Ok ( Json ( cipher . to_json ( & headers . host ,   & headers . user . uuid ,   None ,   CipherSyncType ::User ,   & mut   conn ) . await ) )  
			
		
	
		
		
			
				
					} }  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1203,10 +1174,9 @@ async fn post_attachment_admin( 
			
		
	
		
		
			
				
					     data : Form < UploadData < '_ > > ,      data : Form < UploadData < '_ > > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					
					     post_attachment ( uuid ,   data ,   headers ,   conn ,   ip ,   nt ) . await      post_attachment ( uuid ,   data ,   headers ,   conn ,   nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ post( " /ciphers/<uuid>/attachment/<attachment_id>/share " , format =  " multipart/form-data " , data =  " <data> " ) ] #[ post( " /ciphers/<uuid>/attachment/<attachment_id>/share " , format =  " multipart/form-data " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1216,11 +1186,10 @@ async fn post_attachment_share( 
			
		
	
		
		
			
				
					     data : Form < UploadData < '_ > > ,      data : Form < UploadData < '_ > > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					
					     _delete_cipher_attachment_by_id ( & uuid ,   & attachment_id ,   & headers ,   & mut   conn ,   & ip ,   & nt ) . await ? ;      _delete_cipher_attachment_by_id ( & uuid ,   & attachment_id ,   & headers ,   & mut   conn ,   & nt ) . await ? ;  
			
				
				
			
		
	
		
		
			
				
					
					     post_attachment ( uuid ,   data ,   headers ,   conn ,   ip ,   nt ) . await      post_attachment ( uuid ,   data ,   headers ,   conn ,   nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ post( " /ciphers/<uuid>/attachment/<attachment_id>/delete-admin " ) ] #[ post( " /ciphers/<uuid>/attachment/<attachment_id>/delete-admin " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1229,10 +1198,9 @@ async fn delete_attachment_post_admin( 
			
		
	
		
		
			
				
					     attachment_id : String ,      attachment_id : String ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     delete_attachment ( uuid ,   attachment_id ,   headers ,   conn ,   ip ,   nt ) . await      delete_attachment ( uuid ,   attachment_id ,   headers ,   conn ,   nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ post( " /ciphers/<uuid>/attachment/<attachment_id>/delete " ) ] #[ post( " /ciphers/<uuid>/attachment/<attachment_id>/delete " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1241,10 +1209,9 @@ async fn delete_attachment_post( 
			
		
	
		
		
			
				
					     attachment_id : String ,      attachment_id : String ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     delete_attachment ( uuid ,   attachment_id ,   headers ,   conn ,   ip ,   nt ) . await      delete_attachment ( uuid ,   attachment_id ,   headers ,   conn ,   nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ delete( " /ciphers/<uuid>/attachment/<attachment_id> " ) ] #[ delete( " /ciphers/<uuid>/attachment/<attachment_id> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1253,10 +1220,9 @@ async fn delete_attachment( 
			
		
	
		
		
			
				
					     attachment_id : String ,      attachment_id : String ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     _delete_cipher_attachment_by_id ( & uuid ,   & attachment_id ,   & headers ,   & mut   conn ,   & ip ,   & nt ) . await      _delete_cipher_attachment_by_id ( & uuid ,   & attachment_id ,   & headers ,   & mut   conn ,   & nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ delete( " /ciphers/<uuid>/attachment/<attachment_id>/admin " ) ] #[ delete( " /ciphers/<uuid>/attachment/<attachment_id>/admin " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1265,70 +1231,44 @@ async fn delete_attachment_admin( 
			
		
	
		
		
			
				
					     attachment_id : String ,      attachment_id : String ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     _delete_cipher_attachment_by_id ( & uuid ,   & attachment_id ,   & headers ,   & mut   conn ,   & ip ,   & nt ) . await      _delete_cipher_attachment_by_id ( & uuid ,   & attachment_id ,   & headers ,   & mut   conn ,   & nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ post( " /ciphers/<uuid>/delete " ) ] #[ post( " /ciphers/<uuid>/delete " ) ]  
			
		
	
		
		
			
				
					
					async   fn  delete_cipher_post ( async   fn  delete_cipher_post ( uuid : String ,   headers : Headers ,   mut   conn : DbConn ,   nt : Notify < '_ > )   -> EmptyResult   {  
			
				
				
			
		
	
		
		
			
				
					
					     uuid : String ,      _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   false ,   & nt ) . await  
			
				
				
			
		
	
		
		
			
				
					
					     headers : Headers ,      // permanent delete
  
			
				
				
			
		
	
		
		
			
				
					     mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   {  
			
		
	
		
		
			
				
					     _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   false ,   & ip ,   & nt ) . await   // permanent delete
  
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ post( " /ciphers/<uuid>/delete-admin " ) ] #[ post( " /ciphers/<uuid>/delete-admin " ) ]  
			
		
	
		
		
			
				
					
					async   fn  delete_cipher_post_admin ( async   fn  delete_cipher_post_admin ( uuid : String ,   headers : Headers ,   mut   conn : DbConn ,   nt : Notify < '_ > )   -> EmptyResult   {  
			
				
				
			
		
	
		
		
			
				
					
					     uuid : String ,      _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   false ,   & nt ) . await  
			
				
				
			
		
	
		
		
			
				
					
					     headers : Headers ,      // permanent delete
  
			
				
				
			
		
	
		
		
			
				
					     mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   {  
			
		
	
		
		
			
				
					     _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   false ,   & ip ,   & nt ) . await   // permanent delete
  
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ put( " /ciphers/<uuid>/delete " ) ] #[ put( " /ciphers/<uuid>/delete " ) ]  
			
		
	
		
		
			
				
					
					async   fn  delete_cipher_put ( async   fn  delete_cipher_put ( uuid : String ,   headers : Headers ,   mut   conn : DbConn ,   nt : Notify < '_ > )   -> EmptyResult   {  
			
				
				
			
		
	
		
		
			
				
					
					     uuid : String ,      _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   true ,   & nt ) . await  
			
				
				
			
		
	
		
		
			
				
					
					     headers : Headers ,      // soft delete
  
			
				
				
			
		
	
		
		
			
				
					     mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   {  
			
		
	
		
		
			
				
					     _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   true ,   & ip ,   & nt ) . await   // soft delete
  
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ put( " /ciphers/<uuid>/delete-admin " ) ] #[ put( " /ciphers/<uuid>/delete-admin " ) ]  
			
		
	
		
		
			
				
					
					async   fn  delete_cipher_put_admin ( async   fn  delete_cipher_put_admin ( uuid : String ,   headers : Headers ,   mut   conn : DbConn ,   nt : Notify < '_ > )   -> EmptyResult   {  
			
				
				
			
		
	
		
		
			
				
					
					     uuid : String ,      _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   true ,   & nt ) . await  
			
				
				
			
		
	
		
		
			
				
					     headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   {  
			
		
	
		
		
			
				
					     _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   true ,   & ip ,   & nt ) . await  
			
		
	
		
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ delete( " /ciphers/<uuid> " ) ] #[ delete( " /ciphers/<uuid> " ) ]  
			
		
	
		
		
			
				
					
					async   fn  delete_cipher ( uuid : String ,   headers : Headers ,   mut   conn : DbConn ,   ip : ClientIp ,   nt : Notify < '_ > )   -> EmptyResult   { async   fn  delete_cipher ( uuid : String ,   headers : Headers ,   mut   conn : DbConn ,   nt : Notify < '_ > )   -> EmptyResult   {  
			
				
				
			
		
	
		
		
			
				
					
					     _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   false ,   & ip ,   & nt ) . await   // permanent delete
      _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   false ,   & nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					     // permanent delete
  
			
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ delete( " /ciphers/<uuid>/admin " ) ] #[ delete( " /ciphers/<uuid>/admin " ) ]  
			
		
	
		
		
			
				
					
					async   fn  delete_cipher_admin ( async   fn  delete_cipher_admin ( uuid : String ,   headers : Headers ,   mut   conn : DbConn ,   nt : Notify < '_ > )   -> EmptyResult   {  
			
				
				
			
		
	
		
		
			
				
					
					     uuid : String ,      _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   false ,   & nt ) . await  
			
				
				
			
		
	
		
		
			
				
					
					     headers : Headers ,      // permanent delete
  
			
				
				
			
		
	
		
		
			
				
					     mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   {  
			
		
	
		
		
			
				
					     _delete_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   false ,   & ip ,   & nt ) . await   // permanent delete
  
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ delete( " /ciphers " , data =  " <data> " ) ] #[ delete( " /ciphers " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1336,10 +1276,9 @@ async fn delete_cipher_selected( 
			
		
	
		
		
			
				
					     data : JsonUpcase < Value > ,      data : JsonUpcase < Value > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     _delete_multiple_ciphers ( data ,   headers ,   conn ,   false ,   ip ,   nt ) . await   // permanent delete
      _delete_multiple_ciphers ( data ,   headers ,   conn ,   false ,   nt ) . await   // permanent delete
  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ post( " /ciphers/delete " , data =  " <data> " ) ] #[ post( " /ciphers/delete " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1347,10 +1286,9 @@ async fn delete_cipher_selected_post( 
			
		
	
		
		
			
				
					     data : JsonUpcase < Value > ,      data : JsonUpcase < Value > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     _delete_multiple_ciphers ( data ,   headers ,   conn ,   false ,   ip ,   nt ) . await   // permanent delete
      _delete_multiple_ciphers ( data ,   headers ,   conn ,   false ,   nt ) . await   // permanent delete
  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ put( " /ciphers/delete " , data =  " <data> " ) ] #[ put( " /ciphers/delete " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1358,10 +1296,9 @@ async fn delete_cipher_selected_put( 
			
		
	
		
		
			
				
					     data : JsonUpcase < Value > ,      data : JsonUpcase < Value > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     _delete_multiple_ciphers ( data ,   headers ,   conn ,   true ,   ip ,   nt ) . await   // soft delete
      _delete_multiple_ciphers ( data ,   headers ,   conn ,   true ,   nt ) . await   // soft delete
  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ delete( " /ciphers/admin " , data =  " <data> " ) ] #[ delete( " /ciphers/admin " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1369,10 +1306,9 @@ async fn delete_cipher_selected_admin( 
			
		
	
		
		
			
				
					     data : JsonUpcase < Value > ,      data : JsonUpcase < Value > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     _delete_multiple_ciphers ( data ,   headers ,   conn ,   false ,   ip ,   nt ) . await   // permanent delete
      _delete_multiple_ciphers ( data ,   headers ,   conn ,   false ,   nt ) . await   // permanent delete
  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ post( " /ciphers/delete-admin " , data =  " <data> " ) ] #[ post( " /ciphers/delete-admin " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1380,10 +1316,9 @@ async fn delete_cipher_selected_post_admin( 
			
		
	
		
		
			
				
					     data : JsonUpcase < Value > ,      data : JsonUpcase < Value > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     _delete_multiple_ciphers ( data ,   headers ,   conn ,   false ,   ip ,   nt ) . await   // permanent delete
      _delete_multiple_ciphers ( data ,   headers ,   conn ,   false ,   nt ) . await   // permanent delete
  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ put( " /ciphers/delete-admin " , data =  " <data> " ) ] #[ put( " /ciphers/delete-admin " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1391,32 +1326,19 @@ async fn delete_cipher_selected_put_admin( 
			
		
	
		
		
			
				
					     data : JsonUpcase < Value > ,      data : JsonUpcase < Value > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     conn : DbConn ,      conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					
					     _delete_multiple_ciphers ( data ,   headers ,   conn ,   true ,   ip ,   nt ) . await   // soft delete
      _delete_multiple_ciphers ( data ,   headers ,   conn ,   true ,   nt ) . await   // soft delete
  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ put( " /ciphers/<uuid>/restore " ) ] #[ put( " /ciphers/<uuid>/restore " ) ]  
			
		
	
		
		
			
				
					
					async   fn  restore_cipher_put ( async   fn  restore_cipher_put ( uuid : String ,   headers : Headers ,   mut   conn : DbConn ,   nt : Notify < '_ > )   -> JsonResult   {  
			
				
				
			
		
	
		
		
			
				
					
					     uuid : String ,      _restore_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   & nt ) . await  
			
				
				
			
		
	
		
		
			
				
					     headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   {  
			
		
	
		
		
			
				
					     _restore_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   & ip ,   & nt ) . await  
			
		
	
		
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ put( " /ciphers/<uuid>/restore-admin " ) ] #[ put( " /ciphers/<uuid>/restore-admin " ) ]  
			
		
	
		
		
			
				
					
					async   fn  restore_cipher_put_admin ( async   fn  restore_cipher_put_admin ( uuid : String ,   headers : Headers ,   mut   conn : DbConn ,   nt : Notify < '_ > )   -> JsonResult   {  
			
				
				
			
		
	
		
		
			
				
					
					     uuid : String ,      _restore_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   & nt ) . await  
			
				
				
			
		
	
		
		
			
				
					     headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   {  
			
		
	
		
		
			
				
					     _restore_cipher_by_uuid ( & uuid ,   & headers ,   & mut   conn ,   & ip ,   & nt ) . await  
			
		
	
		
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ put( " /ciphers/restore " , data =  " <data> " ) ] #[ put( " /ciphers/restore " , data =  " <data> " ) ]  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1424,10 +1346,9 @@ async fn restore_cipher_selected( 
			
		
	
		
		
			
				
					     data : JsonUpcase < Value > ,      data : JsonUpcase < Value > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					
					     _restore_multiple_ciphers ( data ,   & headers ,   & mut   conn ,   ip ,   & nt ) . await      _restore_multiple_ciphers ( data ,   & headers ,   & mut   conn ,   & nt ) . await  
			
				
				
			
		
	
		
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					#[ derive(Deserialize) ] #[ derive(Deserialize) ]  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -1499,7 +1420,6 @@ async fn delete_all( 
			
		
	
		
		
			
				
					     data : JsonUpcase < PasswordData > ,      data : JsonUpcase < PasswordData > ,  
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					     let   data : PasswordData   =   data . into_inner ( ) . data ;      let   data : PasswordData   =   data . into_inner ( ) . data ;  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -1527,7 +1447,7 @@ async fn delete_all( 
			
		
	
		
		
			
				
					                             org_data . org_id . clone ( ) ,                              org_data . org_id . clone ( ) ,  
			
		
	
		
		
			
				
					                             user . uuid ,                              user . uuid ,  
			
		
	
		
		
			
				
					                             headers . device . atype ,                              headers . device . atype ,  
			
		
	
		
		
			
				
					
					                             & ip . ip ,                              & headers . ip . ip ,  
			
				
				
			
		
	
		
		
	
		
		
			
				
					                             & mut   conn ,                              & mut   conn ,  
			
		
	
		
		
			
				
					                         )                          )  
			
		
	
		
		
			
				
					                         . await ;                          . await ;  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -1563,7 +1483,6 @@ async fn _delete_cipher_by_uuid( 
			
		
	
		
		
			
				
					     headers : & Headers ,      headers : & Headers ,  
			
		
	
		
		
			
				
					     conn : & mut   DbConn ,      conn : & mut   DbConn ,  
			
		
	
		
		
			
				
					     soft_delete : bool ,      soft_delete : bool ,  
			
		
	
		
		
			
				
					     ip : & ClientIp ,  
			
		
	
		
		
			
				
					     nt : & Notify < '_ > ,      nt : & Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					     let   mut   cipher   =   match   Cipher ::find_by_uuid ( uuid ,   conn ) . await   {      let   mut   cipher   =   match   Cipher ::find_by_uuid ( uuid ,   conn ) . await   {  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -1602,8 +1521,16 @@ async fn _delete_cipher_by_uuid( 
			
		
	
		
		
			
				
					             false   = >   EventType ::CipherDeleted   as   i32 ,              false   = >   EventType ::CipherDeleted   as   i32 ,  
			
		
	
		
		
			
				
					         } ;          } ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					
					         log_event ( event_type ,   & cipher . uuid ,   org_uuid ,   headers . user . uuid . clone ( ) ,   headers . device . atype ,   & ip . ip ,   conn )          log_event (  
			
				
				
			
		
	
		
		
			
				
					
					             . await ;              event_type ,  
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					             & cipher . uuid ,  
			
		
	
		
		
			
				
					             org_uuid ,  
			
		
	
		
		
			
				
					             headers . user . uuid . clone ( ) ,  
			
		
	
		
		
			
				
					             headers . device . atype ,  
			
		
	
		
		
			
				
					             & headers . ip . ip ,  
			
		
	
		
		
			
				
					             conn ,  
			
		
	
		
		
			
				
					         )  
			
		
	
		
		
			
				
					         . await ;  
			
		
	
		
		
			
				
					     }      }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     Ok ( ( ) )      Ok ( ( ) )  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1614,7 +1541,6 @@ async fn _delete_multiple_ciphers( 
			
		
	
		
		
			
				
					     headers : Headers ,      headers : Headers ,  
			
		
	
		
		
			
				
					     mut   conn : DbConn ,      mut   conn : DbConn ,  
			
		
	
		
		
			
				
					     soft_delete : bool ,      soft_delete : bool ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : Notify < '_ > ,      nt : Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					     let   data : Value   =   data . into_inner ( ) . data ;      let   data : Value   =   data . into_inner ( ) . data ;  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1628,7 +1554,7 @@ async fn _delete_multiple_ciphers( 
			
		
	
		
		
			
				
					     } ;      } ;  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     for   uuid   in   uuids   {      for   uuid   in   uuids   {  
			
		
	
		
		
			
				
					
					         if   let   error   @   Err ( _ )   =   _delete_cipher_by_uuid ( uuid ,   & headers ,   & mut   conn ,   soft_delete ,   & ip ,   & nt ) . await   {          if   let   error   @   Err ( _ )   =   _delete_cipher_by_uuid ( uuid ,   & headers ,   & mut   conn ,   soft_delete ,   & nt ) . await   {  
			
				
				
			
		
	
		
		
	
		
		
			
				
					             return   error ;              return   error ;  
			
		
	
		
		
			
				
					         } ;          } ;  
			
		
	
		
		
			
				
					     }      }  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1636,13 +1562,7 @@ async fn _delete_multiple_ciphers( 
			
		
	
		
		
			
				
					     Ok ( ( ) )      Ok ( ( ) )  
			
		
	
		
		
			
				
					} }  
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					
					async   fn  _restore_cipher_by_uuid ( async   fn  _restore_cipher_by_uuid ( uuid : & str ,   headers : & Headers ,   conn : & mut   DbConn ,   nt : & Notify < '_ > )   -> JsonResult   {  
			
				
				
			
		
	
		
		
			
				
					     uuid : & str ,  
			
		
	
		
		
			
				
					     headers : & Headers ,  
			
		
	
		
		
			
				
					     conn : & mut   DbConn ,  
			
		
	
		
		
			
				
					     ip : & ClientIp ,  
			
		
	
		
		
			
				
					     nt : & Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   {  
			
		
	
		
		
	
		
		
			
				
					     let   mut   cipher   =   match   Cipher ::find_by_uuid ( uuid ,   conn ) . await   {      let   mut   cipher   =   match   Cipher ::find_by_uuid ( uuid ,   conn ) . await   {  
			
		
	
		
		
			
				
					         Some ( cipher )   = >   cipher ,          Some ( cipher )   = >   cipher ,  
			
		
	
		
		
			
				
					         None   = >   err ! ( "Cipher doesn't exist" ) ,          None   = >   err ! ( "Cipher doesn't exist" ) ,  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -1669,7 +1589,7 @@ async fn _restore_cipher_by_uuid( 
			
		
	
		
		
			
				
					             String ::from ( org_uuid ) ,              String ::from ( org_uuid ) ,  
			
		
	
		
		
			
				
					             headers . user . uuid . clone ( ) ,              headers . user . uuid . clone ( ) ,  
			
		
	
		
		
			
				
					             headers . device . atype ,              headers . device . atype ,  
			
		
	
		
		
			
				
					
					             & ip . ip ,              & headers . ip . ip ,  
			
				
				
			
		
	
		
		
	
		
		
			
				
					             conn ,              conn ,  
			
		
	
		
		
			
				
					         )          )  
			
		
	
		
		
			
				
					         . await ;          . await ;  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1682,7 +1602,6 @@ async fn _restore_multiple_ciphers( 
			
		
	
		
		
			
				
					     data : JsonUpcase < Value > ,      data : JsonUpcase < Value > ,  
			
		
	
		
		
			
				
					     headers : & Headers ,      headers : & Headers ,  
			
		
	
		
		
			
				
					     conn : & mut   DbConn ,      conn : & mut   DbConn ,  
			
		
	
		
		
			
				
					     ip : ClientIp ,  
			
		
	
		
		
			
				
					     nt : & Notify < '_ > ,      nt : & Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> JsonResult   { )   -> JsonResult   {  
			
		
	
		
		
			
				
					     let   data : Value   =   data . into_inner ( ) . data ;      let   data : Value   =   data . into_inner ( ) . data ;  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1697,7 +1616,7 @@ async fn _restore_multiple_ciphers( 
			
		
	
		
		
			
				
					
 
			
		
	
		
		
			
				
					     let   mut   ciphers : Vec < Value >   =   Vec ::new ( ) ;      let   mut   ciphers : Vec < Value >   =   Vec ::new ( ) ;  
			
		
	
		
		
			
				
					     for   uuid   in   uuids   {      for   uuid   in   uuids   {  
			
		
	
		
		
			
				
					
					         match   _restore_cipher_by_uuid ( uuid ,   headers ,   conn ,   & ip ,   nt ) . await   {          match   _restore_cipher_by_uuid ( uuid ,   headers ,   conn ,   nt ) . await   {  
			
				
				
			
		
	
		
		
	
		
		
			
				
					             Ok ( json )   = >   ciphers . push ( json . into_inner ( ) ) ,              Ok ( json )   = >   ciphers . push ( json . into_inner ( ) ) ,  
			
		
	
		
		
			
				
					             err   = >   return   err ,              err   = >   return   err ,  
			
		
	
		
		
			
				
					         }          }  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -1715,7 +1634,6 @@ async fn _delete_cipher_attachment_by_id( 
			
		
	
		
		
			
				
					     attachment_id : & str ,      attachment_id : & str ,  
			
		
	
		
		
			
				
					     headers : & Headers ,      headers : & Headers ,  
			
		
	
		
		
			
				
					     conn : & mut   DbConn ,      conn : & mut   DbConn ,  
			
		
	
		
		
			
				
					     ip : & ClientIp ,  
			
		
	
		
		
			
				
					     nt : & Notify < '_ > ,      nt : & Notify < '_ > ,  
			
		
	
		
		
			
				
					)   -> EmptyResult   { )   -> EmptyResult   {  
			
		
	
		
		
			
				
					     let   attachment   =   match   Attachment ::find_by_id ( attachment_id ,   conn ) . await   {      let   attachment   =   match   Attachment ::find_by_id ( attachment_id ,   conn ) . await   {  
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -1752,7 +1670,7 @@ async fn _delete_cipher_attachment_by_id( 
			
		
	
		
		
			
				
					             org_uuid ,              org_uuid ,  
			
		
	
		
		
			
				
					             headers . user . uuid . clone ( ) ,              headers . user . uuid . clone ( ) ,  
			
		
	
		
		
			
				
					             headers . device . atype ,              headers . device . atype ,  
			
		
	
		
		
			
				
					
					             & ip . ip ,              & headers . ip . ip ,  
			
				
				
			
		
	
		
		
	
		
		
			
				
					             conn ,              conn ,  
			
		
	
		
		
			
				
					         )          )  
			
		
	
		
		
			
				
					         . await ;          . await ;