From 9ea1774bcf4719c42553dae0a64499b11a5d2ef3 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 11 Oct 2021 11:14:44 +0100 Subject: [PATCH 1/2] Don't perform account deletion check when self hosted --- packages/builder/cypress/support/commands.js | 2 +- .../worker/src/api/controllers/global/users.js | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) 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") + } } } From 060ef711c6b8e91a5ddd29d7931b6dcb4f2134ec Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 11 Oct 2021 11:40:02 +0100 Subject: [PATCH 2/2] API development / debugging optimisations --- package.json | 1 + packages/server/nodemon.json | 2 +- packages/worker/nodemon.json | 3 +++ packages/worker/package.json | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 packages/worker/nodemon.json diff --git a/package.json b/package.json index 3596ec7800..6e9a51a00b 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "kill-port": "kill-port 4001", "dev": "yarn run kill-port && lerna link && lerna run --parallel dev:builder --concurrency 1", "dev:noserver": "lerna link && lerna run dev:stack:up && lerna run --parallel dev:builder --concurrency 1 --ignore @budibase/server --ignore @budibase/worker", + "dev:server": "lerna run --parallel dev:builder --concurrency 1 --scope @budibase/worker --scope @budibase/server", "test": "lerna run test", "lint:eslint": "eslint packages", "lint:prettier": "prettier --check \"packages/**/*.{js,svelte}\"", diff --git a/packages/server/nodemon.json b/packages/server/nodemon.json index a5640776e4..e3a38c0b7d 100644 --- a/packages/server/nodemon.json +++ b/packages/server/nodemon.json @@ -1,5 +1,5 @@ { - "watch": ["src"], + "watch": ["src", "../auth"], "ext": "js,ts,json", "ignore": ["src/**/*.spec.ts", "src/**/*.spec.js"], "exec": "ts-node src/index.ts" diff --git a/packages/worker/nodemon.json b/packages/worker/nodemon.json new file mode 100644 index 0000000000..c2dbd1c71f --- /dev/null +++ b/packages/worker/nodemon.json @@ -0,0 +1,3 @@ +{ + "watch": ["src", "../auth"] +} \ No newline at end of file diff --git a/packages/worker/package.json b/packages/worker/package.json index ced8f73c07..65e7f78091 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -15,7 +15,7 @@ "run:docker": "node src/index.js", "build:docker": "docker build . -t worker-service", "dev:stack:init": "node ./scripts/dev/manage.js init", - "dev:builder": "npm run dev:stack:init && nodemon src/index.js", + "dev:builder": "npm run dev:stack:init && nodemon", "test": "jest --runInBand", "multi:enable": "node scripts/multiTenancy.js enable", "multi:disable": "node scripts/multiTenancy.js disable",