From 7aaa4b38e7112a6cd879c1238310c56b1844c6d8 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Sun, 14 Jan 2024 17:10:49 -0800 Subject: [PATCH] add flex role to export endpoint --- server/endpoints/system.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/server/endpoints/system.js b/server/endpoints/system.js index 39b77a6a10..15db895ad9 100644 --- a/server/endpoints/system.js +++ b/server/endpoints/system.js @@ -389,15 +389,19 @@ function systemEndpoints(app) { } }); - app.get("/system/data-export", [validatedRequest], async (_, response) => { - try { - const { filename, error } = await exportData(); - response.status(200).json({ filename, error }); - } catch (e) { - console.log(e.message, e); - response.sendStatus(500).end(); + app.get( + "/system/data-export", + [validatedRequest, flexUserRoleValid], + async (_, response) => { + try { + const { filename, error } = await exportData(); + response.status(200).json({ filename, error }); + } catch (e) { + console.log(e.message, e); + response.sendStatus(500).end(); + } } - }); + ); app.get("/system/data-exports/:filename", (request, response) => { const exportLocation = __dirname + "/../storage/exports/";