From 7db8c178233bfe6dfc740bdcc71e2c995fa73cf1 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 13 Mar 2024 09:07:58 +0100 Subject: [PATCH] api change path v1 to v2 pandora_enterprise#13019 --- pandora_console/api/documentation/swagger-initializer.js | 2 +- pandora_console/api/{v1 => v2}/.htaccess | 0 pandora_console/api/{v1 => v2}/config/bootstrap.php | 0 pandora_console/api/{v1 => v2}/config/container.php | 0 pandora_console/api/{v1 => v2}/config/generateDoc.php | 0 .../api/{v1 => v2}/config/includeDependencies.php | 0 .../{v1 => v2}/config/includeEnterpriseDependencies.php | 0 pandora_console/api/{v1 => v2}/config/middleware.php | 0 pandora_console/api/{v1 => v2}/config/routes.php | 0 pandora_console/api/{v1 => v2}/config/settings.php | 0 pandora_console/api/{v1 => v2}/public/.htaccess | 0 pandora_console/api/{v1 => v2}/public/index.php | 0 pandora_console/api/{v1 => v2}/public/swagger.json | 2 +- pandora_console/godmode/setup/setup_ITSM.php | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/include/functions.php | 4 +++- .../Modules/Groups/Repositories/GroupRepositoryMySQL.php | 2 -- .../include/lib/Modules/Shared/Documentation/OpenApi.php | 2 +- .../Modules/Shared/Middlewares/UserTokenMiddleware.php | 9 --------- pandora_console/tools/generate_doc.sh | 2 +- 20 files changed, 9 insertions(+), 18 deletions(-) rename pandora_console/api/{v1 => v2}/.htaccess (100%) rename pandora_console/api/{v1 => v2}/config/bootstrap.php (100%) rename pandora_console/api/{v1 => v2}/config/container.php (100%) rename pandora_console/api/{v1 => v2}/config/generateDoc.php (100%) rename pandora_console/api/{v1 => v2}/config/includeDependencies.php (100%) rename pandora_console/api/{v1 => v2}/config/includeEnterpriseDependencies.php (100%) rename pandora_console/api/{v1 => v2}/config/middleware.php (100%) rename pandora_console/api/{v1 => v2}/config/routes.php (100%) rename pandora_console/api/{v1 => v2}/config/settings.php (100%) rename pandora_console/api/{v1 => v2}/public/.htaccess (100%) rename pandora_console/api/{v1 => v2}/public/index.php (100%) rename pandora_console/api/{v1 => v2}/public/swagger.json (99%) diff --git a/pandora_console/api/documentation/swagger-initializer.js b/pandora_console/api/documentation/swagger-initializer.js index d00409f2a7..f4f53b67f6 100644 --- a/pandora_console/api/documentation/swagger-initializer.js +++ b/pandora_console/api/documentation/swagger-initializer.js @@ -23,7 +23,7 @@ window.onload = function() { // the following lines will be replaced by docker/configurator, when it runs in a docker-container const ui = SwaggerUIBundle({ - url: "../v1/swagger.json", + url: "../v2/swagger.json", dom_id: "#swagger-ui", docExpansion: "none", deepLinking: true, diff --git a/pandora_console/api/v1/.htaccess b/pandora_console/api/v2/.htaccess similarity index 100% rename from pandora_console/api/v1/.htaccess rename to pandora_console/api/v2/.htaccess diff --git a/pandora_console/api/v1/config/bootstrap.php b/pandora_console/api/v2/config/bootstrap.php similarity index 100% rename from pandora_console/api/v1/config/bootstrap.php rename to pandora_console/api/v2/config/bootstrap.php diff --git a/pandora_console/api/v1/config/container.php b/pandora_console/api/v2/config/container.php similarity index 100% rename from pandora_console/api/v1/config/container.php rename to pandora_console/api/v2/config/container.php diff --git a/pandora_console/api/v1/config/generateDoc.php b/pandora_console/api/v2/config/generateDoc.php similarity index 100% rename from pandora_console/api/v1/config/generateDoc.php rename to pandora_console/api/v2/config/generateDoc.php diff --git a/pandora_console/api/v1/config/includeDependencies.php b/pandora_console/api/v2/config/includeDependencies.php similarity index 100% rename from pandora_console/api/v1/config/includeDependencies.php rename to pandora_console/api/v2/config/includeDependencies.php diff --git a/pandora_console/api/v1/config/includeEnterpriseDependencies.php b/pandora_console/api/v2/config/includeEnterpriseDependencies.php similarity index 100% rename from pandora_console/api/v1/config/includeEnterpriseDependencies.php rename to pandora_console/api/v2/config/includeEnterpriseDependencies.php diff --git a/pandora_console/api/v1/config/middleware.php b/pandora_console/api/v2/config/middleware.php similarity index 100% rename from pandora_console/api/v1/config/middleware.php rename to pandora_console/api/v2/config/middleware.php diff --git a/pandora_console/api/v1/config/routes.php b/pandora_console/api/v2/config/routes.php similarity index 100% rename from pandora_console/api/v1/config/routes.php rename to pandora_console/api/v2/config/routes.php diff --git a/pandora_console/api/v1/config/settings.php b/pandora_console/api/v2/config/settings.php similarity index 100% rename from pandora_console/api/v1/config/settings.php rename to pandora_console/api/v2/config/settings.php diff --git a/pandora_console/api/v1/public/.htaccess b/pandora_console/api/v2/public/.htaccess similarity index 100% rename from pandora_console/api/v1/public/.htaccess rename to pandora_console/api/v2/public/.htaccess diff --git a/pandora_console/api/v1/public/index.php b/pandora_console/api/v2/public/index.php similarity index 100% rename from pandora_console/api/v1/public/index.php rename to pandora_console/api/v2/public/index.php diff --git a/pandora_console/api/v1/public/swagger.json b/pandora_console/api/v2/public/swagger.json similarity index 99% rename from pandora_console/api/v1/public/swagger.json rename to pandora_console/api/v2/public/swagger.json index 6b27d2b4bb..a7a514bedb 100644 --- a/pandora_console/api/v1/public/swagger.json +++ b/pandora_console/api/v2/public/swagger.json @@ -7,7 +7,7 @@ }, "servers": [ { - "url": "/api/v1", + "url": "/api/v2", "description": "PandoraFMS API Server" } ], diff --git a/pandora_console/godmode/setup/setup_ITSM.php b/pandora_console/godmode/setup/setup_ITSM.php index 899a73a985..725e86d386 100644 --- a/pandora_console/godmode/setup/setup_ITSM.php +++ b/pandora_console/godmode/setup/setup_ITSM.php @@ -123,7 +123,7 @@ $table_remote->data['ITSM_user_level_conf'] = $row; $row = []; $row['hostname'] = html_print_label_input_block( __('URL to Pandora ITSM setup').ui_print_help_tip( - __('Full URL to your Pandora ITSM setup (e.g., http://192.168.1.20/integria/api/v1).'), + __('Full URL to your Pandora ITSM setup (e.g., http://192.168.1.20/integria/api/v2).'), true ), html_print_input_text( diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 1f1feb887c..4b32b6cccc 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -345,7 +345,7 @@ if (empty($container) === true) { // Solution to load the ContainerBuilder class. $containerBuilder = new ContainerBuilder(); - $containerBuilder->addDefinitions(__DIR__.'/../api/v1/config/container.php'); + $containerBuilder->addDefinitions(__DIR__.'/../api/v2/config/container.php'); // Create DI container instance. $container = $containerBuilder->build(); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 13c0028707..b426753c9e 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6904,7 +6904,9 @@ function get_defined_translation($string) } } - if ($config['ignore_cache_translate'] !== true && is_array($cache_translation) === true && count($cache_translation) === 0) { + if ((isset($config['ignore_cache_translate']) === false || $config['ignore_cache_translate'] !== true) + && is_array($cache_translation) === true && count($cache_translation) === 0 + ) { $cache_translation_all = db_get_all_rows_sql( sprintf( 'SELECT translation, string diff --git a/pandora_console/include/lib/Modules/Groups/Repositories/GroupRepositoryMySQL.php b/pandora_console/include/lib/Modules/Groups/Repositories/GroupRepositoryMySQL.php index 59ee52a072..b7ceda64b0 100644 --- a/pandora_console/include/lib/Modules/Groups/Repositories/GroupRepositoryMySQL.php +++ b/pandora_console/include/lib/Modules/Groups/Repositories/GroupRepositoryMySQL.php @@ -164,8 +164,6 @@ class GroupRepositoryMySQL extends RepositoryMySQL implements GroupRepository $pagination ); - hd($sql, true); - return $sql; } } diff --git a/pandora_console/include/lib/Modules/Shared/Documentation/OpenApi.php b/pandora_console/include/lib/Modules/Shared/Documentation/OpenApi.php index 628cdc532a..a2b15588f2 100644 --- a/pandora_console/include/lib/Modules/Shared/Documentation/OpenApi.php +++ b/pandora_console/include/lib/Modules/Shared/Documentation/OpenApi.php @@ -33,7 +33,7 @@ More useful links: * bearerFormat="pandoraBearer", * ), * @OA\Server( - * url="/api/v1", + * url="/api/v2", * description="PandoraFMS API Server" * ), * @OA\Tag( diff --git a/pandora_console/include/lib/Modules/Shared/Middlewares/UserTokenMiddleware.php b/pandora_console/include/lib/Modules/Shared/Middlewares/UserTokenMiddleware.php index fa0f833150..46107f57fe 100644 --- a/pandora_console/include/lib/Modules/Shared/Middlewares/UserTokenMiddleware.php +++ b/pandora_console/include/lib/Modules/Shared/Middlewares/UserTokenMiddleware.php @@ -25,15 +25,6 @@ final class UserTokenMiddleware public function check(Request $request): bool { - hd('El server UUID:', true); - hd($this->config->get('server_unique_identifier'), true); - - hd('El api pass es:', true); - hd($this->config->get('api_password'), true); - - hd('El token de md5 con el que se puede loguear: ', true); - hd(md5($this->config->get('server_unique_identifier')).'-'.md5($this->config->get('api_password')), true); - $authorization = ($request->getHeader('Authorization')[0] ?? ''); $token = null; diff --git a/pandora_console/tools/generate_doc.sh b/pandora_console/tools/generate_doc.sh index 21f886c4cb..219a014694 100755 --- a/pandora_console/tools/generate_doc.sh +++ b/pandora_console/tools/generate_doc.sh @@ -1,3 +1,3 @@ #!/bin/bash -php ../api/v1/config/generateDoc.php \ No newline at end of file +php ../api/v2/config/generateDoc.php \ No newline at end of file