budibase/packages/server/middleware/routeHandlers/upgradeData.js

12 lines
509 B
JavaScript
Raw Normal View History

2020-03-24 11:56:48 +01:00
const StatusCodes = require("../../utilities/statusCodes")
module.exports = async ctx => {
2020-03-27 16:14:50 +01:00
const existingAccessLevels = await ctx.instance.authApi.loadAccessLevels()
2020-03-27 15:49:43 +01:00
const accessLevels = ctx.request.body.accessLevels
2020-03-27 16:14:50 +01:00
accessLevels.version = existingAccessLevels.version
2020-03-27 15:49:43 +01:00
await ctx.instance.authApi.saveAccessLevels(accessLevels)
2020-03-24 11:56:48 +01:00
await ctx.instance.templateApi.upgradeData(ctx.request.body.newHierarchy)
await ctx.master.clearAllSessions(ctx.params.appname)
2020-03-24 11:56:48 +01:00
ctx.response.status = StatusCodes.OK
}