Add get_current_config_processing_tree_nodes_by_path tests
@@ -467,4 +467,51 @@ mod test {
.await
.is_ok());
}
+
+ #[actix_rt::test]
+ async fn get_current_config_node_details_by_path_should_require_view_permission() {
+ // Arrange
+ let api = ConfigApi::new(TestApiHandler {}, Arc::new(TestConfigManager {}));
+ let permissions_map = auth_permissions();
+ let (not_owner_edit_and_view, owner_view, owner_edit, owner_edit_and_view) =
+ create_users(&permissions_map);
+
+ // Act & Assert
+ assert!(
+ ! matches!(
+ api.get_current_config_node_details_by_path(
+ not_owner_edit_and_view,
+ &"root".to_string()
+ ).await,
+ Err(ApiError::ForbiddenError {..})
+ )
+ );
+ assert!(
+ ! matches!(
+ api.get_current_config_node_details_by_path(
+ owner_view,
+ &"root".to_string()
+ ).await,
+ Err(ApiError::ForbiddenError {..})
+ )
+ );
+ assert!(
+ matches!(
+ api.get_current_config_node_details_by_path(
+ owner_edit,
+ &"root".to_string()
+ ).await,
+ Err(ApiError::ForbiddenError {..})
+ )
+ );
+ assert!(
+ ! matches!(
+ api.get_current_config_node_details_by_path(
+ owner_edit_and_view,
+ &"root".to_string()
+ ).await,
+ Err(ApiError::ForbiddenError {..})
+ )
+ );
+ }
}
