upgrading accesslevels

This commit is contained in:
Michael Shanks 2020-03-27 15:14:50 +00:00
parent ca026e6017
commit ddf302f33a
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