From ca026e6017d91e1a32ea2ab3a70601eeb672bd0b Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 27 Mar 2020 14:49:43 +0000 Subject: [PATCH] write access levels --- packages/builder/src/builderStore/store/backend.js | 2 +- packages/server/middleware/routeHandlers/upgradeData.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 1718c3adce..2631b368c3 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -106,7 +106,7 @@ export const saveBackend = async state => { for (let instance of instances_currentFirst) { await api.post( `/_builder/instance/${state.appname}/${instance.id}/api/upgradeData`, - { newHierarchy: state.hierarchy } + { newHierarchy: state.hierarchy, accessLevels: state.accessLevels } ) } } diff --git a/packages/server/middleware/routeHandlers/upgradeData.js b/packages/server/middleware/routeHandlers/upgradeData.js index f25019c4c5..6093ee9109 100644 --- a/packages/server/middleware/routeHandlers/upgradeData.js +++ b/packages/server/middleware/routeHandlers/upgradeData.js @@ -1,6 +1,9 @@ const StatusCodes = require("../../utilities/statusCodes") module.exports = async ctx => { + const accessLevels = ctx.request.body.accessLevels + accessLevels.version = 0 + await ctx.instance.authApi.saveAccessLevels(accessLevels) await ctx.instance.templateApi.upgradeData(ctx.request.body.newHierarchy) ctx.response.status = StatusCodes.OK }