Quick updates based on latest lerna version, as well as some fixes after running through flows (post refactoring).
This commit is contained in:
parent
c2793ede4c
commit
eefac0fe08
|
@ -51,8 +51,8 @@
|
||||||
"kill-builder": "kill-port 3000",
|
"kill-builder": "kill-port 3000",
|
||||||
"kill-server": "kill-port 4001 4002",
|
"kill-server": "kill-port 4001 4002",
|
||||||
"kill-all": "yarn run kill-builder && yarn run kill-server",
|
"kill-all": "yarn run kill-builder && yarn run kill-server",
|
||||||
"dev": "yarn run kill-all && yarn nx run-many --target=dev:builder",
|
"dev": "yarn run kill-all && yarn nx run-many --target=dev:builder --parallel=10",
|
||||||
"dev:noserver": "yarn run kill-builder && lerna run --stream dev:stack:up && yarn nx run-many --target=dev:builder --exclude=@budibase/backend-core,@budibase/server,@budibase/worker",
|
"dev:noserver": "yarn run kill-builder && lerna run --stream dev:stack:up && yarn nx run-many --target=dev:builder --parallel=10 --exclude=@budibase/backend-core,@budibase/server,@budibase/worker",
|
||||||
"dev:server": "yarn run kill-server && yarn nx run-many --target=dev:builder --projects=@budibase/worker,@budibase/server",
|
"dev:server": "yarn run kill-server && yarn nx run-many --target=dev:builder --projects=@budibase/worker,@budibase/server",
|
||||||
"dev:built": "yarn run kill-all && cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream dev:built",
|
"dev:built": "yarn run kill-all && cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream dev:built",
|
||||||
"dev:docker": "yarn build:docker:pre && docker-compose -f hosting/docker-compose.build.yaml -f hosting/docker-compose.dev.yaml --env-file hosting/.env up --build --scale proxy-service=0",
|
"dev:docker": "yarn build:docker:pre && docker-compose -f hosting/docker-compose.build.yaml -f hosting/docker-compose.dev.yaml --env-file hosting/.env up --build --scale proxy-service=0",
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
||||||
import AppLimitModal from "components/portal/licensing/AppLimitModal.svelte"
|
import AppLimitModal from "components/portal/licensing/AppLimitModal.svelte"
|
||||||
import AccountLockedModal from "components/portal/licensing/AccountLockedModal.svelte"
|
import AccountLockedModal from "components/portal/licensing/AccountLockedModal.svelte"
|
||||||
|
import { sdk } from "@budibase/shared-core"
|
||||||
|
|
||||||
import { store, automationStore } from "builderStore"
|
import { store, automationStore } from "builderStore"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
|
@ -237,35 +238,37 @@
|
||||||
{#if enrichedApps.length}
|
{#if enrichedApps.length}
|
||||||
<Layout noPadding gap="L">
|
<Layout noPadding gap="L">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div class="buttons">
|
{#if sdk.isGlobalBuilder($auth.user)}
|
||||||
<Button
|
<div class="buttons">
|
||||||
size="M"
|
|
||||||
cta
|
|
||||||
on:click={usersLimitLockAction || initiateAppCreation}
|
|
||||||
>
|
|
||||||
Create new app
|
|
||||||
</Button>
|
|
||||||
{#if $apps?.length > 0 && !$admin.offlineMode}
|
|
||||||
<Button
|
<Button
|
||||||
size="M"
|
size="M"
|
||||||
secondary
|
cta
|
||||||
on:click={usersLimitLockAction ||
|
on:click={usersLimitLockAction || initiateAppCreation}
|
||||||
$goto("/builder/portal/apps/templates")}
|
|
||||||
>
|
>
|
||||||
View templates
|
Create new app
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{#if $apps?.length > 0 && !$admin.offlineMode}
|
||||||
{#if !$apps?.length}
|
<Button
|
||||||
<Button
|
size="M"
|
||||||
size="L"
|
secondary
|
||||||
quiet
|
on:click={usersLimitLockAction ||
|
||||||
secondary
|
$goto("/builder/portal/apps/templates")}
|
||||||
on:click={usersLimitLockAction || initiateAppImport}
|
>
|
||||||
>
|
View templates
|
||||||
Import app
|
</Button>
|
||||||
</Button>
|
{/if}
|
||||||
{/if}
|
{#if !$apps?.length}
|
||||||
</div>
|
<Button
|
||||||
|
size="L"
|
||||||
|
quiet
|
||||||
|
secondary
|
||||||
|
on:click={usersLimitLockAction || initiateAppImport}
|
||||||
|
>
|
||||||
|
Import app
|
||||||
|
</Button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{#if enrichedApps.length > 1}
|
{#if enrichedApps.length > 1}
|
||||||
<div class="app-actions">
|
<div class="app-actions">
|
||||||
<Select
|
<Select
|
||||||
|
|
|
@ -55,7 +55,7 @@ async function passportCallback(
|
||||||
export const login = async (ctx: Ctx<LoginRequest>, next: any) => {
|
export const login = async (ctx: Ctx<LoginRequest>, next: any) => {
|
||||||
const email = ctx.request.body.username
|
const email = ctx.request.body.username
|
||||||
|
|
||||||
const user = await userSdk.getUserByEmail(email)
|
const user = await userSdk.db.getUserByEmail(email)
|
||||||
if (user && (await userSdk.isPreventPasswordActions(user))) {
|
if (user && (await userSdk.isPreventPasswordActions(user))) {
|
||||||
ctx.throw(403, "Invalid credentials")
|
ctx.throw(403, "Invalid credentials")
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ export const googlePreAuth = async (ctx: any, next: any) => {
|
||||||
const strategy = await google.strategyFactory(
|
const strategy = await google.strategyFactory(
|
||||||
config,
|
config,
|
||||||
callbackUrl,
|
callbackUrl,
|
||||||
userSdk.save
|
userSdk.db.save
|
||||||
)
|
)
|
||||||
|
|
||||||
return passport.authenticate(strategy, {
|
return passport.authenticate(strategy, {
|
||||||
|
@ -193,7 +193,7 @@ export const googleCallback = async (ctx: any, next: any) => {
|
||||||
const strategy = await google.strategyFactory(
|
const strategy = await google.strategyFactory(
|
||||||
config,
|
config,
|
||||||
callbackUrl,
|
callbackUrl,
|
||||||
userSdk.save
|
userSdk.db.save
|
||||||
)
|
)
|
||||||
|
|
||||||
return passport.authenticate(
|
return passport.authenticate(
|
||||||
|
@ -228,7 +228,7 @@ export const oidcStrategyFactory = async (ctx: any, configId: any) => {
|
||||||
|
|
||||||
//Remote Config
|
//Remote Config
|
||||||
const enrichedConfig = await oidc.fetchStrategyConfig(config, callbackUrl)
|
const enrichedConfig = await oidc.fetchStrategyConfig(config, callbackUrl)
|
||||||
return oidc.strategyFactory(enrichedConfig, userSdk.save)
|
return oidc.strategyFactory(enrichedConfig, userSdk.db.save)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -91,7 +91,7 @@ export async function getSelf(ctx: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the main body of the user
|
// get the main body of the user
|
||||||
const user = await userSdk.getUser(userId)
|
const user = await userSdk.db.getUser(userId)
|
||||||
ctx.body = await groups.enrichUserRolesFromGroups(user)
|
ctx.body = await groups.enrichUserRolesFromGroups(user)
|
||||||
|
|
||||||
// add the feature flags for this tenant
|
// add the feature flags for this tenant
|
||||||
|
@ -106,12 +106,12 @@ export async function updateSelf(
|
||||||
) {
|
) {
|
||||||
const update = ctx.request.body
|
const update = ctx.request.body
|
||||||
|
|
||||||
let user = await userSdk.getUser(ctx.user._id!)
|
let user = await userSdk.db.getUser(ctx.user._id!)
|
||||||
user = {
|
user = {
|
||||||
...user,
|
...user,
|
||||||
...update,
|
...update,
|
||||||
}
|
}
|
||||||
user = await userSdk.save(user, { requirePassword: false })
|
user = await userSdk.db.save(user, { requirePassword: false })
|
||||||
|
|
||||||
if (update.password) {
|
if (update.password) {
|
||||||
// Log all other sessions out apart from the current one
|
// Log all other sessions out apart from the current one
|
||||||
|
|
|
@ -41,7 +41,7 @@ describe("/api/global/auth", () => {
|
||||||
|
|
||||||
async function createSSOUser() {
|
async function createSSOUser() {
|
||||||
return config.doInTenant(async () => {
|
return config.doInTenant(async () => {
|
||||||
return userSdk.save(structures.users.ssoUser(), {
|
return userSdk.db.save(structures.users.ssoUser(), {
|
||||||
requirePassword: false,
|
requirePassword: false,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -206,7 +206,7 @@ describe("/api/global/auth", () => {
|
||||||
const newPassword = "newpassword"
|
const newPassword = "newpassword"
|
||||||
const res = await config.api.auth.updatePassword(code!, newPassword)
|
const res = await config.api.auth.updatePassword(code!, newPassword)
|
||||||
|
|
||||||
user = await config.getUser(user.email)
|
user = await config.getUser(user.email) as User
|
||||||
delete user.password
|
delete user.password
|
||||||
|
|
||||||
expect(res.body).toEqual({ message: "password reset successfully." })
|
expect(res.body).toEqual({ message: "password reset successfully." })
|
||||||
|
@ -245,7 +245,7 @@ describe("/api/global/auth", () => {
|
||||||
const ssoUser = user as SSOUser
|
const ssoUser = user as SSOUser
|
||||||
ssoUser.providerType = structures.sso.providerType()
|
ssoUser.providerType = structures.sso.providerType()
|
||||||
delete ssoUser.password
|
delete ssoUser.password
|
||||||
await config.doInTenant(() => userSdk.save(ssoUser))
|
await config.doInTenant(() => userSdk.db.save(ssoUser))
|
||||||
|
|
||||||
await testSSOUser(code!)
|
await testSSOUser(code!)
|
||||||
})
|
})
|
||||||
|
|
|
@ -480,7 +480,7 @@ describe("/api/global/users", () => {
|
||||||
function createSSOUser() {
|
function createSSOUser() {
|
||||||
return config.doInTenant(() => {
|
return config.doInTenant(() => {
|
||||||
const user = structures.users.ssoUser()
|
const user = structures.users.ssoUser()
|
||||||
return userSdk.save(user, { requirePassword: false })
|
return userSdk.db.save(user, { requirePassword: false })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ export const initPro = async () => {
|
||||||
await proSdk.init({
|
await proSdk.init({
|
||||||
scimUserServiceConfig: {
|
scimUserServiceConfig: {
|
||||||
functions: {
|
functions: {
|
||||||
saveUser: userSdk.save,
|
saveUser: userSdk.db.save,
|
||||||
removeUser: (id: string) => userSdk.destroy(id),
|
removeUser: (id: string) => userSdk.db.destroy(id),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -76,9 +76,9 @@ export const reset = async (email: string) => {
|
||||||
export const resetUpdate = async (resetCode: string, password: string) => {
|
export const resetUpdate = async (resetCode: string, password: string) => {
|
||||||
const { userId } = await redis.checkResetPasswordCode(resetCode)
|
const { userId } = await redis.checkResetPasswordCode(resetCode)
|
||||||
|
|
||||||
let user = await userSdk.getUser(userId)
|
let user = await userSdk.db.getUser(userId)
|
||||||
user.password = password
|
user.password = password
|
||||||
user = await userSdk.save(user)
|
user = await userSdk.db.save(user)
|
||||||
|
|
||||||
// remove password from the user before sending events
|
// remove password from the user before sending events
|
||||||
delete user.password
|
delete user.password
|
||||||
|
|
Loading…
Reference in New Issue