mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-10-31 07:56:28 +00:00 
			
		
		
		
	Fix(auth): Forbid index creation on alternates routes
Forbid index creation on alternates routes when the action `index.create` is not given fix #2024
This commit is contained in:
		
				
					committed by
					
						 Maxime Legendre
						Maxime Legendre
					
				
			
			
				
	
			
			
			
						parent
						
							845d3114ea
						
					
				
				
					commit
					a845cd8880
				
			| @@ -50,6 +50,33 @@ impl Server { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     pub async fn new_auth() -> Self { | ||||
|         let dir = TempDir::new().unwrap(); | ||||
|  | ||||
|         if cfg!(windows) { | ||||
|             std::env::set_var("TMP", TEST_TEMP_DIR.path()); | ||||
|         } else { | ||||
|             std::env::set_var("TMPDIR", TEST_TEMP_DIR.path()); | ||||
|         } | ||||
|  | ||||
|         let mut options = default_settings(dir.path()); | ||||
|         options.master_key = Some("MASTER_KEY".to_string()); | ||||
|  | ||||
|         let meilisearch = setup_meilisearch(&options).unwrap(); | ||||
|         let auth = AuthController::new(&options.db_path, &options.master_key).unwrap(); | ||||
|         let service = Service { | ||||
|             meilisearch, | ||||
|             auth, | ||||
|             options, | ||||
|             api_key: None, | ||||
|         }; | ||||
|  | ||||
|         Server { | ||||
|             service, | ||||
|             _dir: Some(dir), | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     pub async fn new_with_options(options: Opt) -> Self { | ||||
|         let meilisearch = setup_meilisearch(&options).unwrap(); | ||||
|         let auth = AuthController::new(&options.db_path, &options.master_key).unwrap(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user