1
0
Fork 0
mirror of synced 2024-06-28 02:50:50 +12:00

Fixing an issue with portal calls causing the app to be re-locked.

This commit is contained in:
mike12345567 2021-05-13 15:32:03 +01:00
parent 95679106ac
commit e560390d8a
4 changed files with 8 additions and 5 deletions

View file

@ -32,6 +32,9 @@ exports.getRedisOptions = (clustered = false) => {
}
exports.addDbPrefix = (db, key) => {
if (key.includes(db)) {
return key
}
return `${db}${SEPARATOR}${key}`
}

View file

@ -2,7 +2,6 @@ const fetch = require("node-fetch")
const env = require("../../environment")
const { checkSlashesInUrl } = require("../../utilities")
const { request } = require("../../utilities/workerRequests")
const { getGlobalIDFromUserMetadataID } = require("../../db/utils")
const { clearLock } = require("../../utilities/redis")
async function redirect(ctx, method) {
@ -35,7 +34,7 @@ exports.redirectDelete = async ctx => {
await redirect(ctx, "DELETE")
}
exports.removeLock = async ctx => {
exports.clearLock = async ctx => {
const { appId } = ctx.params
try {
await clearLock(appId, ctx.user)

View file

@ -16,7 +16,7 @@ if (env.isDev() || env.isTest()) {
router.delete(
"/api/dev/:appId/lock",
authorized(BUILDER),
controller.removeLock
controller.clearLock
)
module.exports = router

View file

@ -41,9 +41,10 @@ module.exports = (permType, permLevel = null) => async (ctx, next) => {
}
const builderCall = permType === PermissionTypes.BUILDER
const referer = ctx.headers["referer"]
const editingApp = referer ? referer.includes(ctx.appId) : false
// this makes sure that builder calls abide by dev locks
if (builderCall) {
if (builderCall && editingApp) {
await checkDevAppLocks(ctx)
}