From f964d7fd83a50e6b82c89560b86f08afe756f62a Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Tue, 10 Aug 2021 11:58:00 +0200 Subject: [PATCH] FEAT #17563 TIME 0:45 added get seda configuration route --- rest/index.php | 1 + .../controllers/ConfigurationController.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/rest/index.php b/rest/index.php index f5a08bacfd6..aef726cabc4 100755 --- a/rest/index.php +++ b/rest/index.php @@ -144,6 +144,7 @@ $app->get('/m2m/configuration', \Configuration\controllers\ConfigurationControll $app->put('/m2m/configuration', \Configuration\controllers\ConfigurationController::class . ':updateM2MConfiguration'); $app->get('/watermark/configuration', \Configuration\controllers\ConfigurationController::class . ':getWatermarkConfiguration'); $app->put('/watermark/configuration', \Configuration\controllers\ConfigurationController::class . ':updateWatermarkConfiguration'); +$app->get('/seda/configuration', \Configuration\controllers\ConfigurationController::class . ':getSedaExportConfiguration'); //Contacts $app->get('/contacts', \Contact\controllers\ContactController::class . ':get'); diff --git a/src/app/configuration/controllers/ConfigurationController.php b/src/app/configuration/controllers/ConfigurationController.php index 9ceed555551..915856fe0cd 100755 --- a/src/app/configuration/controllers/ConfigurationController.php +++ b/src/app/configuration/controllers/ConfigurationController.php @@ -452,4 +452,21 @@ class ConfigurationController return $response->withStatus(204); } + + public function getSedaExportConfiguration(Request $request, Response $response) + { + if (!PrivilegeController::hasPrivilege(['privilegeId' => 'admin_parameters', 'userId' => $GLOBALS['id']])) { + return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); + } + + $config = CoreConfigModel::getJsonLoaded(['path' => CoreConfigModel::getConfigPath()]); + + if (empty($config['exportSeda'])) { + return $response->withJson(['exportSeda' => []]); + } + $config = $config['exportSeda']; + unset($config['token']); + + return $response->withJson(['exportSeda' => $config]); + } } -- GitLab