diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index c8e01435aa..f179a24729 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -5,7 +5,7 @@ // *********************************************** // -Cypress.on('uncaught:exception', (err, runnable) => { +Cypress.on("uncaught:exception", () => { return false }) diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index 38a814f465..1c3328ce61 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -111,14 +111,16 @@ exports.destroy = async ctx => { const db = getGlobalDB() const dbUser = await db.get(ctx.params.id) - // root account holder can't be deleted from inside budibase - const email = dbUser.email - const account = await accounts.getAccount(email) - if (account) { - if (email === ctx.user.email) { - ctx.throw(400, 'Please visit "Account" to delete this user') - } else { - ctx.throw(400, "Account holder cannot be deleted") + if (!env.SELF_HOSTED && !env.DISABLE_ACCOUNT_PORTAL) { + // root account holder can't be deleted from inside budibase + const email = dbUser.email + const account = await accounts.getAccount(email) + if (account) { + if (email === ctx.user.email) { + ctx.throw(400, 'Please visit "Account" to delete this user') + } else { + ctx.throw(400, "Account holder cannot be deleted") + } } }