Merge pull request #2959 from Budibase/wrap-account-check
Don't perform account deletion check when self hosted
This commit is contained in:
commit
70ac21dcbf
|
@ -32,6 +32,7 @@
|
||||||
"kill-port": "kill-port 4001",
|
"kill-port": "kill-port 4001",
|
||||||
"dev": "yarn run kill-port && lerna link && lerna run --parallel dev:builder --concurrency 1",
|
"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: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",
|
"test": "lerna run test",
|
||||||
"lint:eslint": "eslint packages",
|
"lint:eslint": "eslint packages",
|
||||||
"lint:prettier": "prettier --check \"packages/**/*.{js,svelte}\"",
|
"lint:prettier": "prettier --check \"packages/**/*.{js,svelte}\"",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"watch": ["src"],
|
"watch": ["src", "../auth"],
|
||||||
"ext": "js,ts,json",
|
"ext": "js,ts,json",
|
||||||
"ignore": ["src/**/*.spec.ts", "src/**/*.spec.js"],
|
"ignore": ["src/**/*.spec.ts", "src/**/*.spec.js"],
|
||||||
"exec": "ts-node src/index.ts"
|
"exec": "ts-node src/index.ts"
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"watch": ["src", "../auth"]
|
||||||
|
}
|
|
@ -15,7 +15,7 @@
|
||||||
"run:docker": "node src/index.js",
|
"run:docker": "node src/index.js",
|
||||||
"build:docker": "docker build . -t worker-service",
|
"build:docker": "docker build . -t worker-service",
|
||||||
"dev:stack:init": "node ./scripts/dev/manage.js init",
|
"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",
|
"test": "jest --runInBand",
|
||||||
"env:multi:enable": "node scripts/multiTenancy.js enable",
|
"env:multi:enable": "node scripts/multiTenancy.js enable",
|
||||||
"env:multi:disable": "node scripts/multiTenancy.js disable",
|
"env:multi:disable": "node scripts/multiTenancy.js disable",
|
||||||
|
|
|
@ -111,14 +111,16 @@ exports.destroy = async ctx => {
|
||||||
const db = getGlobalDB()
|
const db = getGlobalDB()
|
||||||
const dbUser = await db.get(ctx.params.id)
|
const dbUser = await db.get(ctx.params.id)
|
||||||
|
|
||||||
// root account holder can't be deleted from inside budibase
|
if (!env.SELF_HOSTED && !env.DISABLE_ACCOUNT_PORTAL) {
|
||||||
const email = dbUser.email
|
// root account holder can't be deleted from inside budibase
|
||||||
const account = await accounts.getAccount(email)
|
const email = dbUser.email
|
||||||
if (account) {
|
const account = await accounts.getAccount(email)
|
||||||
if (email === ctx.user.email) {
|
if (account) {
|
||||||
ctx.throw(400, 'Please visit "Account" to delete this user')
|
if (email === ctx.user.email) {
|
||||||
} else {
|
ctx.throw(400, 'Please visit "Account" to delete this user')
|
||||||
ctx.throw(400, "Account holder cannot be deleted")
|
} else {
|
||||||
|
ctx.throw(400, "Account holder cannot be deleted")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue