upgrading accesslevels

This commit is contained in:
Michael Shanks 2020-03-27 15:14:50 +00:00
parent 00eb3ce13a
commit b5473f29c6
1 changed files with 2 additions and 1 deletions

View File

@ -1,8 +1,9 @@
const StatusCodes = require("../../utilities/statusCodes")
module.exports = async ctx => {
const existingAccessLevels = await ctx.instance.authApi.loadAccessLevels()
const accessLevels = ctx.request.body.accessLevels
accessLevels.version = 0
accessLevels.version = existingAccessLevels.version
await ctx.instance.authApi.saveAccessLevels(accessLevels)
await ctx.instance.templateApi.upgradeData(ctx.request.body.newHierarchy)
ctx.response.status = StatusCodes.OK