1
0
Fork 0
mirror of synced 2024-08-13 00:51:22 +12:00

Merge branch 'develop' of github.com:Budibase/budibase into fix/budi-6797

This commit is contained in:
mike12345567 2023-03-30 17:29:58 +01:00
commit 42320b1d95
37 changed files with 198 additions and 163 deletions

View file

@ -1,5 +1,5 @@
{ {
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/backend-core", "name": "@budibase/backend-core",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"description": "Budibase backend core libraries used in server and worker", "description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js", "main": "dist/src/index.js",
"types": "dist/src/index.d.ts", "types": "dist/src/index.d.ts",
@ -24,7 +24,7 @@
"dependencies": { "dependencies": {
"@budibase/nano": "10.1.2", "@budibase/nano": "10.1.2",
"@budibase/pouchdb-replication-stream": "1.2.10", "@budibase/pouchdb-replication-stream": "1.2.10",
"@budibase/types": "2.4.42-alpha.1", "@budibase/types": "2.4.42-alpha.4",
"@shopify/jest-koa-mocks": "5.0.1", "@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",
"aws-cloudfront-sign": "2.2.0", "aws-cloudfront-sign": "2.2.0",

View file

@ -32,8 +32,7 @@ export async function getConfig<T extends Config>(
const db = context.getGlobalDB() const db = context.getGlobalDB()
try { try {
// await to catch error // await to catch error
const config = (await db.get(generateConfigID(type))) as T return (await db.get(generateConfigID(type))) as T
return config
} catch (e: any) { } catch (e: any) {
if (e.status === 404) { if (e.status === 404) {
return return
@ -162,7 +161,10 @@ export async function getGoogleConfig(): Promise<
export async function getGoogleDatasourceConfig(): Promise< export async function getGoogleDatasourceConfig(): Promise<
GoogleInnerConfig | undefined GoogleInnerConfig | undefined
> { > {
return getDefaultGoogleConfig() if (!env.SELF_HOSTED) {
// always use the env vars in cloud
return getDefaultGoogleConfig()
}
// prefer the config in self-host // prefer the config in self-host
let config = await getGoogleConfig() let config = await getGoogleConfig()
@ -176,14 +178,13 @@ export async function getGoogleDatasourceConfig(): Promise<
} }
export function getDefaultGoogleConfig(): GoogleInnerConfig | undefined { export function getDefaultGoogleConfig(): GoogleInnerConfig | undefined {
//if (environment.GOOGLE_CLIENT_ID && environment.GOOGLE_CLIENT_SECRET) { if (environment.GOOGLE_CLIENT_ID && environment.GOOGLE_CLIENT_SECRET) {
return { return {
clientID: clientID: environment.GOOGLE_CLIENT_ID!,
"77746844610-62k43m9b4so4gcmf6ibs7p3l7jv81rug.apps.googleusercontent.com", clientSecret: environment.GOOGLE_CLIENT_SECRET!,
clientSecret: "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", activated: true,
activated: true, }
} }
//}
} }
// OIDC // OIDC

View file

@ -1,4 +1,9 @@
import { DBTestConfiguration, generator, testEnv } from "../../../tests" import {
DBTestConfiguration,
generator,
testEnv,
structures,
} from "../../../tests"
import { ConfigType } from "@budibase/types" import { ConfigType } from "@budibase/types"
import env from "../../environment" import env from "../../environment"
import * as configs from "../configs" import * as configs from "../configs"
@ -113,4 +118,71 @@ describe("configs", () => {
}) })
}) })
}) })
describe("getGoogleDatasourceConfig", () => {
function setEnvVars() {
env.GOOGLE_CLIENT_SECRET = "test"
env.GOOGLE_CLIENT_ID = "test"
}
function unsetEnvVars() {
env.GOOGLE_CLIENT_SECRET = undefined
env.GOOGLE_CLIENT_ID = undefined
}
describe("cloud", () => {
beforeEach(() => {
testEnv.cloudHosted()
})
it("returns from env vars", async () => {
await config.doInTenant(async () => {
setEnvVars()
const config = await configs.getGoogleDatasourceConfig()
unsetEnvVars()
expect(config).toEqual({
activated: true,
clientID: "test",
clientSecret: "test",
})
})
})
it("returns undefined when no env vars are configured", async () => {
await config.doInTenant(async () => {
const config = await configs.getGoogleDatasourceConfig()
expect(config).toBeUndefined()
})
})
})
describe("self host", () => {
beforeEach(() => {
testEnv.selfHosted()
})
it("returns from config", async () => {
await config.doInTenant(async () => {
const googleDoc = structures.sso.googleConfigDoc()
await configs.save(googleDoc)
const config = await configs.getGoogleDatasourceConfig()
expect(config).toEqual(googleDoc.config)
})
})
it("falls back to env vars when config is disabled", async () => {
await config.doInTenant(async () => {
setEnvVars()
const config = await configs.getGoogleDatasourceConfig()
unsetEnvVars()
expect(config).toEqual({
activated: true,
clientID: "test",
clientSecret: "test",
})
})
})
})
})
}) })

View file

@ -1,4 +1,6 @@
import { import {
ConfigType,
GoogleConfig,
GoogleInnerConfig, GoogleInnerConfig,
JwtClaims, JwtClaims,
OAuth2, OAuth2,
@ -10,10 +12,10 @@ import {
User, User,
} from "@budibase/types" } from "@budibase/types"
import { generator } from "./generator" import { generator } from "./generator"
import { uuid, email } from "./common" import { email, uuid } from "./common"
import * as shared from "./shared" import * as shared from "./shared"
import _ from "lodash"
import { user } from "./shared" import { user } from "./shared"
import _ from "lodash"
export function OAuth(): OAuth2 { export function OAuth(): OAuth2 {
return { return {
@ -107,3 +109,11 @@ export function googleConfig(): GoogleInnerConfig {
clientSecret: generator.string(), clientSecret: generator.string(),
} }
} }
export function googleConfigDoc(): GoogleConfig {
return {
_id: "config_google",
type: ConfigType.GOOGLE,
config: googleConfig(),
}
}

View file

@ -1,7 +1,7 @@
{ {
"name": "@budibase/bbui", "name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.", "description": "A UI solution used in the different Budibase projects.",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"license": "MPL-2.0", "license": "MPL-2.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"module": "dist/bbui.es.js", "module": "dist/bbui.es.js",
@ -38,8 +38,8 @@
], ],
"dependencies": { "dependencies": {
"@adobe/spectrum-css-workflow-icons": "1.2.1", "@adobe/spectrum-css-workflow-icons": "1.2.1",
"@budibase/shared-core": "2.4.42-alpha.1", "@budibase/shared-core": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.1", "@budibase/string-templates": "2.4.42-alpha.4",
"@spectrum-css/accordion": "3.0.24", "@spectrum-css/accordion": "3.0.24",
"@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actionbutton": "1.0.1",
"@spectrum-css/actiongroup": "1.0.1", "@spectrum-css/actiongroup": "1.0.1",

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/builder", "name": "@budibase/builder",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"license": "GPL-3.0", "license": "GPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -58,11 +58,11 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "2.4.42-alpha.1", "@budibase/bbui": "2.4.42-alpha.4",
"@budibase/client": "2.4.42-alpha.1", "@budibase/client": "2.4.42-alpha.4",
"@budibase/frontend-core": "2.4.42-alpha.1", "@budibase/frontend-core": "2.4.42-alpha.4",
"@budibase/shared-core": "2.4.42-alpha.1", "@budibase/shared-core": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.1", "@budibase/string-templates": "2.4.42-alpha.4",
"@fortawesome/fontawesome-svg-core": "^6.2.1", "@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1", "@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1", "@fortawesome/free-solid-svg-icons": "^6.2.1",

View file

@ -12,7 +12,7 @@
// kill the reference so the input isn't saved // kill the reference so the input isn't saved
let datasource = cloneDeep(integration) let datasource = cloneDeep(integration)
$: isGoogleConfigured = !!$organisation.google $: isGoogleConfigured = !!$organisation.googleDatasourceConfigured
onMount(async () => { onMount(async () => {
await organisation.init() await organisation.init()

View file

@ -1,6 +1,6 @@
<script> <script>
import { isActive, redirect, params } from "@roxi/routify" import { isActive, redirect, params } from "@roxi/routify"
import { admin, auth, licensing, tenants } from "stores/portal" import { admin, auth, licensing } from "stores/portal"
import { onMount } from "svelte" import { onMount } from "svelte"
import { CookieUtils, Constants } from "@budibase/frontend-core" import { CookieUtils, Constants } from "@budibase/frontend-core"
import { API } from "api" import { API } from "api"
@ -10,24 +10,27 @@
$: multiTenancyEnabled = $admin.multiTenancy $: multiTenancyEnabled = $admin.multiTenancy
$: hasAdminUser = $admin?.checklist?.adminUser?.checked $: hasAdminUser = $admin?.checklist?.adminUser?.checked
$: baseUrl = $admin?.baseUrl
$: tenantSet = $auth.tenantSet $: tenantSet = $auth.tenantSet
$: cloud = $admin.cloud $: cloud = $admin?.cloud
$: user = $auth.user $: user = $auth.user
$: useAccountPortal = cloud && !$admin.disableAccountPortal $: useAccountPortal = cloud && !$admin.disableAccountPortal
const validateTenantId = async () => { const validateTenantId = async () => {
const host = window.location.host const host = window.location.host
if (host.includes("localhost:")) { if (host.includes("localhost:") || !baseUrl) {
// ignore local dev // ignore local dev
return return
} }
// e.g. ['tenant', 'budibase', 'app'] vs ['budibase', 'app'] const mainHost = new URL(baseUrl).host
let urlTenantId let urlTenantId
const hostParts = host.split(".") // remove the main host part
if (hostParts.length > 2) { const hostParts = host.split(mainHost).filter(part => part !== "")
urlTenantId = hostParts[0] // if there is a part left, it has to be the tenant ID subdomain
if (hostParts.length === 1) {
urlTenantId = hostParts[0].replace(/\./g, "")
} }
if (user && user.tenantId) { if (user && user.tenantId) {
@ -41,16 +44,15 @@
return return
} }
// check if real tenant if (urlTenantId && user.tenantId !== urlTenantId) {
const { exists: tenantExists } = await tenants.info(urlTenantId)
if (tenantExists && user.tenantId !== urlTenantId) {
// user should not be here - play it safe and log them out // user should not be here - play it safe and log them out
try { try {
await auth.logout() await auth.logout()
await auth.setOrganisation(null) await auth.setOrganisation(null)
} catch (error) { } catch (error) {
console.error("Tenant mis-match, logout.") console.error(
`Tenant mis-match - "${urlTenantId}" and "${user.tenantId}" - logout`
)
} }
} }
} else { } else {

View file

@ -53,6 +53,7 @@ export function createAdminStore() {
store.disableAccountPortal = environment.disableAccountPortal store.disableAccountPortal = environment.disableAccountPortal
store.accountPortalUrl = environment.accountPortalUrl store.accountPortalUrl = environment.accountPortalUrl
store.isDev = environment.isDev store.isDev = environment.isDev
store.baseUrl = environment.baseUrl
return store return store
}) })
} }

View file

@ -14,4 +14,3 @@ export { overview } from "./overview"
export { environment } from "./environment" export { environment } from "./environment"
export { menu } from "./menu" export { menu } from "./menu"
export { auditLogs } from "./auditLogs" export { auditLogs } from "./auditLogs"
export { tenants } from "./tenants"

View file

@ -19,6 +19,7 @@ const DEFAULT_CONFIG = {
company: "Budibase", company: "Budibase",
oidc: undefined, oidc: undefined,
google: undefined, google: undefined,
googleDatasourceConfigured: undefined,
oidcCallbackUrl: "", oidcCallbackUrl: "",
googleCallbackUrl: "", googleCallbackUrl: "",
isSSOEnforced: false, isSSOEnforced: false,
@ -39,6 +40,7 @@ export function createOrganisationStore() {
const storeConfig = _.cloneDeep(get(store)) const storeConfig = _.cloneDeep(get(store))
delete storeConfig.oidc delete storeConfig.oidc
delete storeConfig.google delete storeConfig.google
delete storeConfig.googleDatasourceConfigured
delete storeConfig.oidcCallbackUrl delete storeConfig.oidcCallbackUrl
delete storeConfig.googleCallbackUrl delete storeConfig.googleCallbackUrl
await API.saveConfig({ await API.saveConfig({

View file

@ -1,27 +0,0 @@
import { writable, get } from "svelte/store"
import { API } from "api"
export function tenantsStore() {
const store = writable({ tenantInfo: {} })
return {
info: async tenantId => {
if (!tenantId) {
return { exists: false }
}
const contents = get(store)
const found = contents.tenantInfo[tenantId]
if (found) {
return found
}
const tenantInfo = await API.getTenantInfo(tenantId)
store.update(state => {
state.tenantInfo[tenantId] = tenantInfo
return state
})
return tenantInfo
},
}
}
export const tenants = tenantsStore()

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"description": "Budibase CLI, for developers, self hosting and migrations.", "description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {
@ -29,9 +29,9 @@
"outputPath": "build" "outputPath": "build"
}, },
"dependencies": { "dependencies": {
"@budibase/backend-core": "2.4.42-alpha.1", "@budibase/backend-core": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.1", "@budibase/string-templates": "2.4.42-alpha.4",
"@budibase/types": "2.4.42-alpha.1", "@budibase/types": "2.4.42-alpha.4",
"axios": "0.21.2", "axios": "0.21.2",
"chalk": "4.1.0", "chalk": "4.1.0",
"cli-progress": "3.11.2", "cli-progress": "3.11.2",

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/client", "name": "@budibase/client",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"license": "MPL-2.0", "license": "MPL-2.0",
"module": "dist/budibase-client.js", "module": "dist/budibase-client.js",
"main": "dist/budibase-client.js", "main": "dist/budibase-client.js",
@ -19,11 +19,11 @@
"dev:builder": "rollup -cw" "dev:builder": "rollup -cw"
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "2.4.42-alpha.1", "@budibase/bbui": "2.4.42-alpha.4",
"@budibase/frontend-core": "2.4.42-alpha.1", "@budibase/frontend-core": "2.4.42-alpha.4",
"@budibase/shared-core": "2.4.42-alpha.1", "@budibase/shared-core": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.1", "@budibase/string-templates": "2.4.42-alpha.4",
"@budibase/types": "2.4.42-alpha.1", "@budibase/types": "2.4.42-alpha.4",
"@spectrum-css/button": "^3.0.3", "@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3", "@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3", "@spectrum-css/divider": "^1.0.3",

View file

@ -1,13 +1,13 @@
{ {
"name": "@budibase/frontend-core", "name": "@budibase/frontend-core",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"description": "Budibase frontend core libraries used in builder and client", "description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase", "author": "Budibase",
"license": "MPL-2.0", "license": "MPL-2.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"dependencies": { "dependencies": {
"@budibase/bbui": "2.4.42-alpha.1", "@budibase/bbui": "2.4.42-alpha.4",
"@budibase/shared-core": "2.4.42-alpha.1", "@budibase/shared-core": "2.4.42-alpha.4",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"svelte": "^3.46.2" "svelte": "^3.46.2"
} }

View file

@ -29,7 +29,6 @@ import { buildBackupsEndpoints } from "./backups"
import { buildEnvironmentVariableEndpoints } from "./environmentVariables" import { buildEnvironmentVariableEndpoints } from "./environmentVariables"
import { buildEventEndpoints } from "./events" import { buildEventEndpoints } from "./events"
import { buildAuditLogsEndpoints } from "./auditLogs" import { buildAuditLogsEndpoints } from "./auditLogs"
import { buildTenantEndpoints } from "./tenants"
const defaultAPIClientConfig = { const defaultAPIClientConfig = {
/** /**
@ -254,6 +253,5 @@ export const createAPIClient = config => {
...buildEnvironmentVariableEndpoints(API), ...buildEnvironmentVariableEndpoints(API),
...buildEventEndpoints(API), ...buildEventEndpoints(API),
...buildAuditLogsEndpoints(API), ...buildAuditLogsEndpoints(API),
...buildTenantEndpoints(API),
} }
} }

View file

@ -1,8 +0,0 @@
export const buildTenantEndpoints = API => ({
/**
* Get information about a tenant
*/
getTenantInfo: async tenantId => {
return await API.get({ url: `/api/system/tenants/${tenantId}/info` })
},
})

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/sdk", "name": "@budibase/sdk",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"description": "Budibase Public API SDK", "description": "Budibase Public API SDK",
"author": "Budibase", "author": "Budibase",
"license": "MPL-2.0", "license": "MPL-2.0",

View file

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -44,12 +44,12 @@
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@apidevtools/swagger-parser": "10.0.3", "@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "2.4.42-alpha.1", "@budibase/backend-core": "2.4.42-alpha.4",
"@budibase/client": "2.4.42-alpha.1", "@budibase/client": "2.4.42-alpha.4",
"@budibase/pro": "2.4.42-alpha.1", "@budibase/pro": "2.4.42-alpha.4",
"@budibase/shared-core": "2.4.42-alpha.1", "@budibase/shared-core": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.1", "@budibase/string-templates": "2.4.42-alpha.4",
"@budibase/types": "2.4.42-alpha.1", "@budibase/types": "2.4.42-alpha.4",
"@bull-board/api": "3.7.0", "@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4", "@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0", "@elastic/elasticsearch": "7.10.0",

View file

@ -23,7 +23,7 @@
<!-- Opengraph Meta Tags --> <!-- Opengraph Meta Tags -->
<meta property="og:site_name" content="Budibase" /> <meta property="og:site_name" content="Budibase" />
<meta property="og:title" content="{title} - built with Budibase" /> <meta property="og:title" content={metaTitle} />
<meta property="og:description" content={metaDescription} /> <meta property="og:description" content={metaDescription} />
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:image" content={metaImage} /> <meta property="og:image" content={metaImage} />
@ -32,8 +32,8 @@
<meta property="twitter:card" content="summary_large_image" /> <meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:site" content="@budibase" /> <meta property="twitter:site" content="@budibase" />
<meta property="twitter:image" content={metaImage} /> <meta property="twitter:image" content={metaImage} />
<meta property="twitter:image:alt" content="{title} - built with Budibase" /> <meta property="twitter:image:alt" content={metaTitle} />
<meta property="twitter:title" content="{title} - built with Budibase" /> <meta property="twitter:title" content={metaTitle} />
<meta property="twitter:description" content={metaDescription} /> <meta property="twitter:description" content={metaDescription} />
<title>{title}</title> <title>{title}</title>

View file

@ -1290,14 +1290,14 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.4.42-alpha.1": "@budibase/backend-core@2.4.42-alpha.4":
version "2.4.42-alpha.1" version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.42-alpha.1.tgz#bdba3782aa57864bbb86b13c27315780c40a550d" resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.42-alpha.4.tgz#e4e86811dab639e211c3c4ad540841279f634115"
integrity sha512-GH3OJAJB0FHJ/xYUHTFkYvOLqoDp9vDtYhB9McKYY6dZJJdkTa89PJgsVBb5vMDo8y6y5sFLQg1nBoDbzgDSMQ== integrity sha512-var93QWJbwPHQtR4zIy/7g8ABOT2fQb43FMC2A+CLAQnJxBCu0Rcvk/5jkwOe18Te2+AiylC1OIGfvVbD3TTYA==
dependencies: dependencies:
"@budibase/nano" "10.1.2" "@budibase/nano" "10.1.2"
"@budibase/pouchdb-replication-stream" "1.2.10" "@budibase/pouchdb-replication-stream" "1.2.10"
"@budibase/types" "2.4.42-alpha.1" "@budibase/types" "2.4.42-alpha.4"
"@shopify/jest-koa-mocks" "5.0.1" "@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2" "@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0" aws-cloudfront-sign "2.2.0"
@ -1429,14 +1429,14 @@
pouchdb-promise "^6.0.4" pouchdb-promise "^6.0.4"
through2 "^2.0.0" through2 "^2.0.0"
"@budibase/pro@2.4.42-alpha.1": "@budibase/pro@2.4.42-alpha.4":
version "2.4.42-alpha.1" version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.42-alpha.1.tgz#c38d730d10673d783a5c841d49af27412177c165" resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.42-alpha.4.tgz#8e81d08b4363c59e6aa872f532287327c2ef5e1e"
integrity sha512-s1Le0l8rCGCd1wK3lOHlMWH0I+mNClhSydvTTsdqSw1lz97u+5ZXxx+Rd2DPEhitJUrpghoCgg+stArdWhzmeA== integrity sha512-6/CMcDnLRSzimR1JVy2FindRzN0YEo/B4lwYPtS2T5ORyCSBL24flwD15lhp2W4g0e1TF/+fPK/EaEXhJZglBg==
dependencies: dependencies:
"@budibase/backend-core" "2.4.42-alpha.1" "@budibase/backend-core" "2.4.42-alpha.4"
"@budibase/string-templates" "2.3.20" "@budibase/string-templates" "2.3.20"
"@budibase/types" "2.4.42-alpha.1" "@budibase/types" "2.4.42-alpha.4"
"@koa/router" "8.0.8" "@koa/router" "8.0.8"
bull "4.10.1" bull "4.10.1"
joi "17.6.0" joi "17.6.0"
@ -1475,10 +1475,10 @@
lodash "^4.17.20" lodash "^4.17.20"
vm2 "^3.9.4" vm2 "^3.9.4"
"@budibase/types@2.4.42-alpha.1": "@budibase/types@2.4.42-alpha.4":
version "2.4.42-alpha.1" version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.42-alpha.1.tgz#5e69ffe9ab255af883735113e6c81c00b3391f46" resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.42-alpha.4.tgz#4a1ae0a9cd03e4ee0f81f64a494fbfd13ddbfdf6"
integrity sha512-bKqXKbPX+G9oEaF3mWM43s8Molosgr5OcVjqlNDcb2lWIWHJ8E7hDNYd3y4tGIet8Af0oyAXcMQsLSkotBWZAQ== integrity sha512-eBB+VVtkld140Jno/quRlwlu9Q1GkeLyUQeXSrOed8dlmmImS4UKpOpAru+YxTklIvexJsM9H+AQw39IZR7L3g==
"@bull-board/api@3.7.0": "@bull-board/api@3.7.0":
version "3.7.0" version "3.7.0"

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/shared-core", "name": "@budibase/shared-core",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"description": "Shared data utils", "description": "Shared data utils",
"main": "dist/cjs/src/index.js", "main": "dist/cjs/src/index.js",
"types": "dist/mjs/src/index.d.ts", "types": "dist/mjs/src/index.d.ts",
@ -20,7 +20,7 @@
"dev:builder": "yarn prebuild && concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc -p tsconfig-cjs.build.json --watch\"" "dev:builder": "yarn prebuild && concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc -p tsconfig-cjs.build.json --watch\""
}, },
"dependencies": { "dependencies": {
"@budibase/types": "2.4.42-alpha.1" "@budibase/types": "2.4.42-alpha.4"
}, },
"devDependencies": { "devDependencies": {
"concurrently": "^7.6.0", "concurrently": "^7.6.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"description": "Handlebars wrapper for Budibase templating.", "description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs", "main": "src/index.cjs",
"module": "dist/bundle.mjs", "module": "dist/bundle.mjs",

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/types", "name": "@budibase/types",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"description": "Budibase types", "description": "Budibase types",
"main": "dist/cjs/index.js", "main": "dist/cjs/index.js",
"types": "dist/mjs/index.d.ts", "types": "dist/mjs/index.d.ts",

View file

@ -5,6 +5,7 @@ import { SettingsConfig, SettingsInnerConfig } from "../../../documents"
*/ */
export interface PublicSettingsInnerConfig extends SettingsInnerConfig { export interface PublicSettingsInnerConfig extends SettingsInnerConfig {
google: boolean google: boolean
googleDatasourceConfigured: boolean
oidc: boolean oidc: boolean
oidcCallbackUrl: string oidcCallbackUrl: string
googleCallbackUrl: string googleCallbackUrl: string

View file

@ -1,7 +1,7 @@
{ {
"name": "@budibase/worker", "name": "@budibase/worker",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "2.4.42-alpha.1", "version": "2.4.42-alpha.4",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -36,10 +36,10 @@
"author": "Budibase", "author": "Budibase",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@budibase/backend-core": "2.4.42-alpha.1", "@budibase/backend-core": "2.4.42-alpha.4",
"@budibase/pro": "2.4.42-alpha.1", "@budibase/pro": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.1", "@budibase/string-templates": "2.4.42-alpha.4",
"@budibase/types": "2.4.42-alpha.1", "@budibase/types": "2.4.42-alpha.4",
"@koa/router": "8.0.8", "@koa/router": "8.0.8",
"@sentry/node": "6.17.7", "@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",

View file

@ -332,6 +332,8 @@ export async function publicSettings(
// google // google
const googleConfig = await configs.getGoogleConfig() const googleConfig = await configs.getGoogleConfig()
const googleDatasourceConfigured =
!!(await configs.getGoogleDatasourceConfig())
const preActivated = googleConfig && googleConfig.activated == null const preActivated = googleConfig && googleConfig.activated == null
const google = preActivated || !!googleConfig?.activated const google = preActivated || !!googleConfig?.activated
const _googleCallbackUrl = await googleCallbackUrl(googleConfig) const _googleCallbackUrl = await googleCallbackUrl(googleConfig)
@ -352,6 +354,7 @@ export async function publicSettings(
...config, ...config,
...branding, ...branding,
google, google,
googleDatasourceConfigured,
oidc, oidc,
isSSOEnforced, isSSOEnforced,
oidcCallbackUrl: _oidcCallbackUrl, oidcCallbackUrl: _oidcCallbackUrl,

View file

@ -7,6 +7,7 @@ export const fetch = async (ctx: BBContext) => {
cloud: !env.SELF_HOSTED, cloud: !env.SELF_HOSTED,
accountPortalUrl: env.ACCOUNT_PORTAL_URL, accountPortalUrl: env.ACCOUNT_PORTAL_URL,
disableAccountPortal: env.DISABLE_ACCOUNT_PORTAL, disableAccountPortal: env.DISABLE_ACCOUNT_PORTAL,
baseUrl: env.PLATFORM_URL,
// in test need to pretend its in production for the UI (Cypress) // in test need to pretend its in production for the UI (Cypress)
isDev: env.isDev() && !env.isTest(), isDev: env.isDev() && !env.isTest(),
} }

View file

@ -290,6 +290,7 @@ describe("configs", () => {
logoUrl: "", logoUrl: "",
analyticsEnabled: false, analyticsEnabled: false,
google: false, google: false,
googleDatasourceConfigured: false,
googleCallbackUrl: `http://localhost:10000/api/global/auth/${config.tenantId}/google/callback`, googleCallbackUrl: `http://localhost:10000/api/global/auth/${config.tenantId}/google/callback`,
isSSOEnforced: false, isSSOEnforced: false,
oidc: false, oidc: false,

View file

@ -10,6 +10,4 @@ router.delete(
controller.destroy controller.destroy
) )
router.get("/api/system/tenants/:tenantId/info", controller.info)
export default router export default router

View file

@ -23,6 +23,7 @@ describe("/api/system/environment", () => {
disableAccountPortal: 0, disableAccountPortal: 0,
isDev: false, isDev: false,
multiTenancy: true, multiTenancy: true,
baseUrl: "http://localhost:10000",
}) })
}) })
}) })

View file

@ -58,17 +58,4 @@ describe("/api/global/tenants", () => {
expect(res.body).toEqual(config.adminOnlyResponse()) expect(res.body).toEqual(config.adminOnlyResponse())
}) })
}) })
describe("GET /api/system/tenants/:tenantId/info", () => {
it("allows retrieving information about the tenant", async () => {
const user1 = await config.createTenant()
const res = await config.api.tenants.info(user1.tenantId)
expect(res.body.exists).toEqual(true)
})
it("check a tenant that doesn't exist", async () => {
const res = await config.api.tenants.info("cannot-exist-tenantid")
expect(res.body.exists).toEqual(false)
})
})
}) })

View file

@ -14,11 +14,4 @@ export class TenantAPI extends TestAPI {
.set(opts?.headers) .set(opts?.headers)
.expect(opts?.status ? opts.status : 204) .expect(opts?.status ? opts.status : 204)
} }
info = (tenantId: string) => {
return this.request
.get(`/api/system/tenants/${tenantId}/info`)
.set(this.config.defaultHeaders())
.expect(200)
}
} }

View file

@ -475,14 +475,14 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.4.42-alpha.1": "@budibase/backend-core@2.4.42-alpha.4":
version "2.4.42-alpha.1" version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.42-alpha.1.tgz#bdba3782aa57864bbb86b13c27315780c40a550d" resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.42-alpha.4.tgz#e4e86811dab639e211c3c4ad540841279f634115"
integrity sha512-GH3OJAJB0FHJ/xYUHTFkYvOLqoDp9vDtYhB9McKYY6dZJJdkTa89PJgsVBb5vMDo8y6y5sFLQg1nBoDbzgDSMQ== integrity sha512-var93QWJbwPHQtR4zIy/7g8ABOT2fQb43FMC2A+CLAQnJxBCu0Rcvk/5jkwOe18Te2+AiylC1OIGfvVbD3TTYA==
dependencies: dependencies:
"@budibase/nano" "10.1.2" "@budibase/nano" "10.1.2"
"@budibase/pouchdb-replication-stream" "1.2.10" "@budibase/pouchdb-replication-stream" "1.2.10"
"@budibase/types" "2.4.42-alpha.1" "@budibase/types" "2.4.42-alpha.4"
"@shopify/jest-koa-mocks" "5.0.1" "@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2" "@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0" aws-cloudfront-sign "2.2.0"
@ -564,14 +564,14 @@
pouchdb-promise "^6.0.4" pouchdb-promise "^6.0.4"
through2 "^2.0.0" through2 "^2.0.0"
"@budibase/pro@2.4.42-alpha.1": "@budibase/pro@2.4.42-alpha.4":
version "2.4.42-alpha.1" version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.42-alpha.1.tgz#c38d730d10673d783a5c841d49af27412177c165" resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.42-alpha.4.tgz#8e81d08b4363c59e6aa872f532287327c2ef5e1e"
integrity sha512-s1Le0l8rCGCd1wK3lOHlMWH0I+mNClhSydvTTsdqSw1lz97u+5ZXxx+Rd2DPEhitJUrpghoCgg+stArdWhzmeA== integrity sha512-6/CMcDnLRSzimR1JVy2FindRzN0YEo/B4lwYPtS2T5ORyCSBL24flwD15lhp2W4g0e1TF/+fPK/EaEXhJZglBg==
dependencies: dependencies:
"@budibase/backend-core" "2.4.42-alpha.1" "@budibase/backend-core" "2.4.42-alpha.4"
"@budibase/string-templates" "2.3.20" "@budibase/string-templates" "2.3.20"
"@budibase/types" "2.4.42-alpha.1" "@budibase/types" "2.4.42-alpha.4"
"@koa/router" "8.0.8" "@koa/router" "8.0.8"
bull "4.10.1" bull "4.10.1"
joi "17.6.0" joi "17.6.0"
@ -592,10 +592,10 @@
lodash "^4.17.20" lodash "^4.17.20"
vm2 "^3.9.4" vm2 "^3.9.4"
"@budibase/types@2.4.42-alpha.1": "@budibase/types@2.4.42-alpha.4":
version "2.4.42-alpha.1" version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.42-alpha.1.tgz#5e69ffe9ab255af883735113e6c81c00b3391f46" resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.42-alpha.4.tgz#4a1ae0a9cd03e4ee0f81f64a494fbfd13ddbfdf6"
integrity sha512-bKqXKbPX+G9oEaF3mWM43s8Molosgr5OcVjqlNDcb2lWIWHJ8E7hDNYd3y4tGIet8Af0oyAXcMQsLSkotBWZAQ== integrity sha512-eBB+VVtkld140Jno/quRlwlu9Q1GkeLyUQeXSrOed8dlmmImS4UKpOpAru+YxTklIvexJsM9H+AQw39IZR7L3g==
"@cspotcode/source-map-support@^0.8.0": "@cspotcode/source-map-support@^0.8.0":
version "0.8.1" version "0.8.1"

View file

@ -21,7 +21,7 @@
"api:test:ci": "start-server-and-test api:server:setup:ci http://localhost:4100/builder test", "api:test:ci": "start-server-and-test api:server:setup:ci http://localhost:4100/builder test",
"api:test": "start-server-and-test api:server:setup http://localhost:4100/builder test", "api:test": "start-server-and-test api:server:setup http://localhost:4100/builder test",
"api:test:local": "env-cmd jest --runInBand --testPathIgnorePatterns=\\\"\\/dataSources\\/\\\"", "api:test:local": "env-cmd jest --runInBand --testPathIgnorePatterns=\\\"\\/dataSources\\/\\\"",
"api:test:nightly": "env-cmd jest --runInBand --outputFile=testResults.json" "api:test:nightly": "env-cmd jest --runInBand --json --outputFile=testResults.json"
}, },
"jest": { "jest": {
"preset": "ts-jest", "preset": "ts-jest",

View file

@ -10,7 +10,7 @@ const GITHUB_ACTIONS_RUN_URL = process.env.GITHUB_ACTIONS_RUN_URL
async function generateReport() { async function generateReport() {
// read the report file // read the report file
const REPORT_PATH = path.resolve(__dirname, "..", "testReport.json") const REPORT_PATH = path.resolve(__dirname, "..", "testResults.json")
const report = fs.readFileSync(REPORT_PATH, "utf-8") const report = fs.readFileSync(REPORT_PATH, "utf-8")
return JSON.parse(report) return JSON.parse(report)
} }