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

12 lines
509 B
JavaScript

const StatusCodes = require("../../utilities/statusCodes")
module.exports = async ctx => {
const existingAccessLevels = await ctx.instance.authApi.loadAccessLevels()
const accessLevels = ctx.request.body.accessLevels
accessLevels.version = existingAccessLevels.version
await ctx.instance.authApi.saveAccessLevels(accessLevels)
await ctx.instance.templateApi.upgradeData(ctx.request.body.newHierarchy)
await ctx.master.clearAllSessions(ctx.params.appname)
ctx.response.status = StatusCodes.OK
}