Merge branch 'develop' of github.com:Budibase/budibase into dnd
This commit is contained in:
commit
6ba4c00b80
|
@ -128,6 +128,6 @@ static_resources:
|
||||||
- endpoint:
|
- endpoint:
|
||||||
address:
|
address:
|
||||||
socket_address:
|
socket_address:
|
||||||
address: couchdb-service.budibase.svc.cluster.local
|
address: budibase-prod-svc-couchdb
|
||||||
port_value: 5984
|
port_value: 5984
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "0.9.125-alpha.14",
|
"version": "0.9.125-alpha.17",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/auth",
|
"name": "@budibase/auth",
|
||||||
"version": "0.9.125-alpha.14",
|
"version": "0.9.125-alpha.17",
|
||||||
"description": "Authentication middlewares for budibase builder and apps",
|
"description": "Authentication middlewares for budibase builder and apps",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
|
|
|
@ -75,6 +75,9 @@ function isDevApp(app) {
|
||||||
* @return {null|string} The tenant ID found within the app ID.
|
* @return {null|string} The tenant ID found within the app ID.
|
||||||
*/
|
*/
|
||||||
exports.getTenantIDFromAppID = appId => {
|
exports.getTenantIDFromAppID = appId => {
|
||||||
|
if (!appId) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
const split = appId.split(SEPARATOR)
|
const split = appId.split(SEPARATOR)
|
||||||
const hasDev = split[1] === DocumentTypes.DEV
|
const hasDev = split[1] === DocumentTypes.DEV
|
||||||
if ((hasDev && split.length === 3) || (!hasDev && split.length === 2)) {
|
if ((hasDev && split.length === 3) || (!hasDev && split.length === 2)) {
|
||||||
|
@ -236,9 +239,12 @@ exports.getAllApps = async (CouchDB, { dev, all, idsOnly } = {}) => {
|
||||||
const split = dbName.split(SEPARATOR)
|
const split = dbName.split(SEPARATOR)
|
||||||
// it is an app, check the tenantId
|
// it is an app, check the tenantId
|
||||||
if (split[0] === DocumentTypes.APP) {
|
if (split[0] === DocumentTypes.APP) {
|
||||||
const noTenantId = split.length === 2 || split[1] === DocumentTypes.DEV
|
|
||||||
// tenantId is always right before the UUID
|
// tenantId is always right before the UUID
|
||||||
const possibleTenantId = split[split.length - 2]
|
const possibleTenantId = split[split.length - 2]
|
||||||
|
|
||||||
|
const noTenantId =
|
||||||
|
split.length === 2 || possibleTenantId === DocumentTypes.DEV
|
||||||
|
|
||||||
return (
|
return (
|
||||||
(tenantId === DEFAULT_TENANT_ID && noTenantId) ||
|
(tenantId === DEFAULT_TENANT_ID && noTenantId) ||
|
||||||
possibleTenantId === tenantId
|
possibleTenantId === tenantId
|
||||||
|
|
|
@ -56,7 +56,6 @@ function init() {
|
||||||
if (CLIENT) {
|
if (CLIENT) {
|
||||||
CLIENT.disconnect()
|
CLIENT.disconnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
const { redisProtocolUrl, opts, host, port } = getRedisOptions(CLUSTERED)
|
const { redisProtocolUrl, opts, host, port } = getRedisOptions(CLUSTERED)
|
||||||
|
|
||||||
if (CLUSTERED) {
|
if (CLUSTERED) {
|
||||||
|
|
|
@ -63,6 +63,7 @@ exports.tryAddTenant = async (tenantId, userId, email) => {
|
||||||
}
|
}
|
||||||
if (emailDoc) {
|
if (emailDoc) {
|
||||||
emailDoc.tenantId = tenantId
|
emailDoc.tenantId = tenantId
|
||||||
|
emailDoc.userId = userId
|
||||||
promises.push(db.put(emailDoc))
|
promises.push(db.put(emailDoc))
|
||||||
}
|
}
|
||||||
if (tenants.tenantIds.indexOf(tenantId) === -1) {
|
if (tenants.tenantIds.indexOf(tenantId) === -1) {
|
||||||
|
|
|
@ -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": "0.9.125-alpha.14",
|
"version": "0.9.125-alpha.17",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"svelte": "src/index.js",
|
"svelte": "src/index.js",
|
||||||
"module": "dist/bbui.es.js",
|
"module": "dist/bbui.es.js",
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
export let enableTime = true
|
export let enableTime = true
|
||||||
export let value = null
|
export let value = null
|
||||||
export let placeholder = null
|
export let placeholder = null
|
||||||
export let appendTo = null
|
export let appendTo = undefined
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
const flatpickrId = `${generateID()}-wrapper`
|
const flatpickrId = `${generateID()}-wrapper`
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
export let error = null
|
export let error = null
|
||||||
export let enableTime = true
|
export let enableTime = true
|
||||||
export let placeholder = null
|
export let placeholder = null
|
||||||
export let appendTo = null
|
export let appendTo = undefined
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
const onChange = e => {
|
const onChange = e => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "0.9.125-alpha.14",
|
"version": "0.9.125-alpha.17",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -65,10 +65,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^0.9.125-alpha.14",
|
"@budibase/bbui": "^0.9.125-alpha.17",
|
||||||
"@budibase/client": "^0.9.125-alpha.14",
|
"@budibase/client": "^0.9.125-alpha.17",
|
||||||
"@budibase/colorpicker": "1.1.2",
|
"@budibase/colorpicker": "1.1.2",
|
||||||
"@budibase/string-templates": "^0.9.125-alpha.14",
|
"@budibase/string-templates": "^0.9.125-alpha.17",
|
||||||
"@sentry/browser": "5.19.1",
|
"@sentry/browser": "5.19.1",
|
||||||
"@spectrum-css/page": "^3.0.1",
|
"@spectrum-css/page": "^3.0.1",
|
||||||
"@spectrum-css/vars": "^3.0.1",
|
"@spectrum-css/vars": "^3.0.1",
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// redirect to account portal for authentication in the cloud
|
// redirect to account portal for authentication in the cloud
|
||||||
if ($admin.cloud && $admin.accountPortalUrl) {
|
if (!$auth.user && $admin.cloud && $admin.accountPortalUrl) {
|
||||||
window.location.href = $admin.accountPortalUrl
|
window.location.href = $admin.accountPortalUrl
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
if (sortBy === "status") {
|
if (sortBy === "status") {
|
||||||
return enrichedApps.sort((a, b) => {
|
return enrichedApps.sort((a, b) => {
|
||||||
if (a.status === b.status) {
|
if (a.status === b.status) {
|
||||||
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1
|
return a.name?.toLowerCase() < b.name?.toLowerCase() ? -1 : 1
|
||||||
}
|
}
|
||||||
return a.status === AppStatus.DEPLOYED ? -1 : 1
|
return a.status === AppStatus.DEPLOYED ? -1 : 1
|
||||||
})
|
})
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
return enrichedApps.sort((a, b) => {
|
return enrichedApps.sort((a, b) => {
|
||||||
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1
|
return a.name?.toLowerCase() < b.name?.toLowerCase() ? -1 : 1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,11 @@ import { get } from "builderStore/api"
|
||||||
import { AppStatus } from "../../constants"
|
import { AppStatus } from "../../constants"
|
||||||
import api from "../../builderStore/api"
|
import api from "../../builderStore/api"
|
||||||
|
|
||||||
|
const extractAppId = id => {
|
||||||
|
const split = id?.split("_") || []
|
||||||
|
return split.length ? split[split.length - 1] : null
|
||||||
|
}
|
||||||
|
|
||||||
export function createAppStore() {
|
export function createAppStore() {
|
||||||
const store = writable([])
|
const store = writable([])
|
||||||
|
|
||||||
|
@ -18,7 +23,7 @@ export function createAppStore() {
|
||||||
|
|
||||||
// First append all dev app version
|
// First append all dev app version
|
||||||
devApps.forEach(app => {
|
devApps.forEach(app => {
|
||||||
const id = app.appId.substring(8)
|
const id = extractAppId(app.appId)
|
||||||
appMap[id] = {
|
appMap[id] = {
|
||||||
...app,
|
...app,
|
||||||
devId: app.appId,
|
devId: app.appId,
|
||||||
|
@ -28,7 +33,13 @@ export function createAppStore() {
|
||||||
|
|
||||||
// Then merge with all prod app versions
|
// Then merge with all prod app versions
|
||||||
deployedApps.forEach(app => {
|
deployedApps.forEach(app => {
|
||||||
const id = app.appId.substring(4)
|
const id = extractAppId(app.appId)
|
||||||
|
|
||||||
|
// Skip any deployed apps which don't have a dev counterpart
|
||||||
|
if (!appMap[id]) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
appMap[id] = {
|
appMap[id] = {
|
||||||
...appMap[id],
|
...appMap[id],
|
||||||
...app,
|
...app,
|
||||||
|
@ -40,7 +51,7 @@ export function createAppStore() {
|
||||||
// Transform into an array and clean up
|
// Transform into an array and clean up
|
||||||
const apps = Object.values(appMap)
|
const apps = Object.values(appMap)
|
||||||
apps.forEach(app => {
|
apps.forEach(app => {
|
||||||
app.appId = app.devId.substring(8)
|
app.appId = extractAppId(app.devId)
|
||||||
delete app._id
|
delete app._id
|
||||||
delete app._rev
|
delete app._rev
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/cli",
|
"name": "@budibase/cli",
|
||||||
"version": "0.9.125-alpha.14",
|
"version": "0.9.125-alpha.17",
|
||||||
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/client",
|
"name": "@budibase/client",
|
||||||
"version": "0.9.125-alpha.14",
|
"version": "0.9.125-alpha.17",
|
||||||
"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,9 +19,8 @@
|
||||||
"dev:builder": "rollup -cw"
|
"dev:builder": "rollup -cw"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^0.9.125-alpha.14",
|
"@budibase/bbui": "^0.9.125-alpha.17",
|
||||||
"@budibase/standard-components": "^0.9.124",
|
"@budibase/string-templates": "^0.9.125-alpha.17",
|
||||||
"@budibase/string-templates": "^0.9.125-alpha.14",
|
|
||||||
"regexparam": "^1.3.0",
|
"regexparam": "^1.3.0",
|
||||||
"shortid": "^2.2.15",
|
"shortid": "^2.2.15",
|
||||||
"svelte-spa-router": "^3.0.5"
|
"svelte-spa-router": "^3.0.5"
|
||||||
|
|
|
@ -28,59 +28,10 @@
|
||||||
chalk "^2.0.0"
|
chalk "^2.0.0"
|
||||||
js-tokens "^4.0.0"
|
js-tokens "^4.0.0"
|
||||||
|
|
||||||
"@budibase/bbui@^0.9.125-alpha.11":
|
"@budibase/bbui@^0.9.125-alpha.17":
|
||||||
version "0.9.130"
|
version "0.9.133"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.130.tgz#cad02a7aa16324eb7a056c5dc0162444fa917964"
|
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.133.tgz#91a2fb24abaaf91d2cb1e00eb51c493c1290f9ad"
|
||||||
integrity sha512-ULOC++363K8QEMasmsDmleF7AzjulFk/ZxGPlOJcVKJU8Bx5wG1uNFgTyJyGpmnbUWHd67eYUEettfH7I+VoOw==
|
integrity sha512-xbMmc/hee1QRNW7TrbGUBmLr1hMHXqUDA6rdl9N2PGfHFuFWbqlD8PWYanHmLevVet+CjkuKGPSbBghFK2pQyQ==
|
||||||
dependencies:
|
|
||||||
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
|
|
||||||
"@spectrum-css/actionbutton" "^1.0.1"
|
|
||||||
"@spectrum-css/actiongroup" "^1.0.1"
|
|
||||||
"@spectrum-css/avatar" "^3.0.2"
|
|
||||||
"@spectrum-css/button" "^3.0.1"
|
|
||||||
"@spectrum-css/buttongroup" "^3.0.2"
|
|
||||||
"@spectrum-css/checkbox" "^3.0.2"
|
|
||||||
"@spectrum-css/dialog" "^3.0.1"
|
|
||||||
"@spectrum-css/divider" "^1.0.3"
|
|
||||||
"@spectrum-css/dropzone" "^3.0.2"
|
|
||||||
"@spectrum-css/fieldgroup" "^3.0.2"
|
|
||||||
"@spectrum-css/fieldlabel" "^3.0.1"
|
|
||||||
"@spectrum-css/icon" "^3.0.1"
|
|
||||||
"@spectrum-css/illustratedmessage" "^3.0.2"
|
|
||||||
"@spectrum-css/inputgroup" "^3.0.2"
|
|
||||||
"@spectrum-css/label" "^2.0.10"
|
|
||||||
"@spectrum-css/link" "^3.1.1"
|
|
||||||
"@spectrum-css/menu" "^3.0.1"
|
|
||||||
"@spectrum-css/modal" "^3.0.1"
|
|
||||||
"@spectrum-css/pagination" "^3.0.3"
|
|
||||||
"@spectrum-css/picker" "^1.0.1"
|
|
||||||
"@spectrum-css/popover" "^3.0.1"
|
|
||||||
"@spectrum-css/progressbar" "^1.0.2"
|
|
||||||
"@spectrum-css/progresscircle" "^1.0.2"
|
|
||||||
"@spectrum-css/radio" "^3.0.2"
|
|
||||||
"@spectrum-css/search" "^3.0.2"
|
|
||||||
"@spectrum-css/sidenav" "^3.0.2"
|
|
||||||
"@spectrum-css/statuslight" "^3.0.2"
|
|
||||||
"@spectrum-css/stepper" "^3.0.3"
|
|
||||||
"@spectrum-css/switch" "^1.0.2"
|
|
||||||
"@spectrum-css/table" "^3.0.1"
|
|
||||||
"@spectrum-css/tabs" "^3.0.1"
|
|
||||||
"@spectrum-css/tags" "^3.0.2"
|
|
||||||
"@spectrum-css/textfield" "^3.0.1"
|
|
||||||
"@spectrum-css/toast" "^3.0.1"
|
|
||||||
"@spectrum-css/tooltip" "^3.0.3"
|
|
||||||
"@spectrum-css/treeview" "^3.0.2"
|
|
||||||
"@spectrum-css/typography" "^3.0.1"
|
|
||||||
"@spectrum-css/underlay" "^2.0.9"
|
|
||||||
"@spectrum-css/vars" "^3.0.1"
|
|
||||||
dayjs "^1.10.4"
|
|
||||||
svelte-flatpickr "^3.1.0"
|
|
||||||
svelte-portal "^1.0.0"
|
|
||||||
|
|
||||||
"@budibase/bbui@^0.9.129":
|
|
||||||
version "0.9.129"
|
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.129.tgz#989bf60d404772d4b308382faba7adac6518ec3e"
|
|
||||||
integrity sha512-U3uO9K3m7Ph5RQpzXx5IIy94s/KdU9Q8eJXFQwH6neYIKQk3OFo8br5px5C7lE38mtazqq9XvQy0f+MUarKk4A==
|
|
||||||
dependencies:
|
dependencies:
|
||||||
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
|
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
|
||||||
"@spectrum-css/actionbutton" "^1.0.1"
|
"@spectrum-css/actionbutton" "^1.0.1"
|
||||||
|
@ -154,28 +105,10 @@
|
||||||
to-gfm-code-block "^0.1.1"
|
to-gfm-code-block "^0.1.1"
|
||||||
year "^0.2.1"
|
year "^0.2.1"
|
||||||
|
|
||||||
"@budibase/standard-components@^0.9.124":
|
"@budibase/string-templates@^0.9.125-alpha.17":
|
||||||
version "0.9.129"
|
version "0.9.133"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.129.tgz#f2cdead99b8f25177c4c291be3032fb9ffd1dac3"
|
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.133.tgz#221d81e080dc4485dcffa989d16e2bbed39f9055"
|
||||||
integrity sha512-RYWBcrz4MGICg9neIPQ4CbU3WTTJoTofi2D4pwA+qvvN3uhqOCcFIZ3+yadZ5Akz2qwMztQ8WDvetowm2srZcA==
|
integrity sha512-SMHcSPwHYdAqol9YCcMoYawp5/ETr9TqGZCUsL+hUUq+LritPwu/miQ++SVvRTQbOR7Mker0S9LO3H8mwYkW8w==
|
||||||
dependencies:
|
|
||||||
"@budibase/bbui" "^0.9.129"
|
|
||||||
"@spectrum-css/button" "^3.0.3"
|
|
||||||
"@spectrum-css/card" "^3.0.3"
|
|
||||||
"@spectrum-css/divider" "^1.0.3"
|
|
||||||
"@spectrum-css/link" "^3.1.3"
|
|
||||||
"@spectrum-css/page" "^3.0.1"
|
|
||||||
"@spectrum-css/typography" "^3.0.2"
|
|
||||||
"@spectrum-css/vars" "^3.0.1"
|
|
||||||
apexcharts "^3.22.1"
|
|
||||||
dayjs "^1.10.5"
|
|
||||||
svelte-apexcharts "^1.0.2"
|
|
||||||
svelte-flatpickr "^3.1.0"
|
|
||||||
|
|
||||||
"@budibase/string-templates@^0.9.125-alpha.11":
|
|
||||||
version "0.9.130"
|
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.130.tgz#1be8affcba0dc8ff2b8044c65dd378dc76a165d0"
|
|
||||||
integrity sha512-DXO6Um18/k16i3hYilxvQ4RYNHhd29OJGbzjfQZ2v7z4Oin5y+WMZzpjX1hQS5g9f/CBbzu7qd7EHiz/n8gMqg==
|
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/handlebars-helpers" "^0.11.4"
|
"@budibase/handlebars-helpers" "^0.11.4"
|
||||||
dayjs "^1.10.4"
|
dayjs "^1.10.4"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "0.9.125-alpha.14",
|
"version": "0.9.125-alpha.17",
|
||||||
"description": "Budibase Web Server",
|
"description": "Budibase Web Server",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -64,9 +64,9 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/auth": "^0.9.125-alpha.14",
|
"@budibase/auth": "^0.9.125-alpha.17",
|
||||||
"@budibase/client": "^0.9.125-alpha.14",
|
"@budibase/client": "^0.9.125-alpha.17",
|
||||||
"@budibase/string-templates": "^0.9.125-alpha.14",
|
"@budibase/string-templates": "^0.9.125-alpha.17",
|
||||||
"@elastic/elasticsearch": "7.10.0",
|
"@elastic/elasticsearch": "7.10.0",
|
||||||
"@koa/router": "8.0.0",
|
"@koa/router": "8.0.0",
|
||||||
"@sendgrid/mail": "7.1.1",
|
"@sendgrid/mail": "7.1.1",
|
||||||
|
@ -118,7 +118,6 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.14.3",
|
"@babel/core": "^7.14.3",
|
||||||
"@babel/preset-env": "^7.14.4",
|
"@babel/preset-env": "^7.14.4",
|
||||||
"@budibase/standard-components": "^0.9.124",
|
|
||||||
"@jest/test-sequencer": "^24.8.0",
|
"@jest/test-sequencer": "^24.8.0",
|
||||||
"@types/bull": "^3.15.1",
|
"@types/bull": "^3.15.1",
|
||||||
"@types/jest": "^26.0.23",
|
"@types/jest": "^26.0.23",
|
||||||
|
|
|
@ -189,15 +189,27 @@ exports.trigger = async function (ctx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prepareTestInput(input) {
|
||||||
|
// prepare the test parameters
|
||||||
|
if (input.id && input.row) {
|
||||||
|
input.row._id = input.id
|
||||||
|
}
|
||||||
|
if (input.revision && input.row) {
|
||||||
|
input.row._rev = input.revision
|
||||||
|
}
|
||||||
|
return input
|
||||||
|
}
|
||||||
|
|
||||||
exports.test = async function (ctx) {
|
exports.test = async function (ctx) {
|
||||||
const appId = ctx.appId
|
const appId = ctx.appId
|
||||||
const db = new CouchDB(appId)
|
const db = new CouchDB(appId)
|
||||||
let automation = await db.get(ctx.params.id)
|
let automation = await db.get(ctx.params.id)
|
||||||
await setTestFlag(automation._id)
|
await setTestFlag(automation._id)
|
||||||
|
const testInput = prepareTestInput(ctx.request.body)
|
||||||
const response = await triggers.externalTrigger(
|
const response = await triggers.externalTrigger(
|
||||||
automation,
|
automation,
|
||||||
{
|
{
|
||||||
...ctx.request.body,
|
...testInput,
|
||||||
appId,
|
appId,
|
||||||
},
|
},
|
||||||
{ getResponses: true }
|
{ getResponses: true }
|
||||||
|
|
|
@ -7,9 +7,10 @@ const Queue = env.isTest()
|
||||||
: require("bull")
|
: require("bull")
|
||||||
const { JobQueues } = require("../constants")
|
const { JobQueues } = require("../constants")
|
||||||
const { utils } = require("@budibase/auth/redis")
|
const { utils } = require("@budibase/auth/redis")
|
||||||
const { opts } = utils.getRedisOptions()
|
const { opts, redisProtocolUrl } = utils.getRedisOptions()
|
||||||
|
|
||||||
let automationQueue = new Queue(JobQueues.AUTOMATIONS, { redis: opts })
|
const redisConfig = redisProtocolUrl || { redis: opts }
|
||||||
|
let automationQueue = new Queue(JobQueues.AUTOMATIONS, redisConfig)
|
||||||
|
|
||||||
exports.pathPrefix = "/bulladmin"
|
exports.pathPrefix = "/bulladmin"
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ exports.run = async function ({ inputs, context }) {
|
||||||
let stdout,
|
let stdout,
|
||||||
success = true
|
success = true
|
||||||
try {
|
try {
|
||||||
stdout = execSync(command, { timeout: 500 })
|
stdout = execSync(command, { timeout: 500 }).toString()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
stdout = err.message
|
stdout = err.message
|
||||||
success = false
|
success = false
|
||||||
|
|
|
@ -97,12 +97,16 @@ exports.run = async function ({ inputs }) {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
}
|
}
|
||||||
|
|
||||||
if (headers && headers.length !== 0) {
|
if (headers) {
|
||||||
try {
|
try {
|
||||||
const customHeaders = JSON.parse(headers)
|
const customHeaders =
|
||||||
|
typeof headers === "string" ? JSON.parse(headers) : headers
|
||||||
request.headers = { ...request.headers, ...customHeaders }
|
request.headers = { ...request.headers, ...customHeaders }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
return {
|
||||||
|
success: false,
|
||||||
|
response: "Unable to process headers, must be a JSON object.",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -943,10 +943,10 @@
|
||||||
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/auth@^0.9.125-alpha.11":
|
"@budibase/auth@^0.9.125-alpha.17":
|
||||||
version "0.9.130"
|
version "0.9.133"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.130.tgz#04ff77b862e87e22b08ee7bebd5409ff479a2b35"
|
resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.133.tgz#280d581820c9069b6bc021f88178c215ee48ad08"
|
||||||
integrity sha512-wCgbnk8YvBtRQhmWd7w9UGNLL1ocJPHCq10652Dxm8nLnY0oAsgzVVoMsMULyTypfHiYtUEnOs7+JQ/nYa2zkA==
|
integrity sha512-DL7zIYRXE6xSKE/qbHMf/SX3+bceGxM4xzUmLTk4OHtEOP/vaUJr35tkhznAZF7VpUR9Yh20D6/Zw8z/3sxj/A==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@techpass/passport-openidconnect" "^0.3.0"
|
"@techpass/passport-openidconnect" "^0.3.0"
|
||||||
aws-sdk "^2.901.0"
|
aws-sdk "^2.901.0"
|
||||||
|
@ -966,10 +966,10 @@
|
||||||
uuid "^8.3.2"
|
uuid "^8.3.2"
|
||||||
zlib "^1.0.5"
|
zlib "^1.0.5"
|
||||||
|
|
||||||
"@budibase/bbui@^0.9.127":
|
"@budibase/bbui@^0.9.133":
|
||||||
version "0.9.127"
|
version "0.9.133"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.127.tgz#e038338d69476d45afe1d4c4ef36971d8d0c59bd"
|
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.133.tgz#91a2fb24abaaf91d2cb1e00eb51c493c1290f9ad"
|
||||||
integrity sha512-fcUVzC7lOGUxLFEptaLTNSproMQa4cf5tSCo5atU9gDoPHVdIncocPWJuuLM1hM2JIlk8IiJ+up9CdiDur8FsA==
|
integrity sha512-xbMmc/hee1QRNW7TrbGUBmLr1hMHXqUDA6rdl9N2PGfHFuFWbqlD8PWYanHmLevVet+CjkuKGPSbBghFK2pQyQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
|
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
|
||||||
"@spectrum-css/actionbutton" "^1.0.1"
|
"@spectrum-css/actionbutton" "^1.0.1"
|
||||||
|
@ -1015,63 +1015,14 @@
|
||||||
svelte-flatpickr "^3.1.0"
|
svelte-flatpickr "^3.1.0"
|
||||||
svelte-portal "^1.0.0"
|
svelte-portal "^1.0.0"
|
||||||
|
|
||||||
"@budibase/bbui@^0.9.130":
|
"@budibase/client@^0.9.125-alpha.17":
|
||||||
version "0.9.130"
|
version "0.9.133"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.130.tgz#cad02a7aa16324eb7a056c5dc0162444fa917964"
|
resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.9.133.tgz#43748e189e9b92d99d1281ab62bd2c5ebed5dbab"
|
||||||
integrity sha512-ULOC++363K8QEMasmsDmleF7AzjulFk/ZxGPlOJcVKJU8Bx5wG1uNFgTyJyGpmnbUWHd67eYUEettfH7I+VoOw==
|
integrity sha512-JrduL9iVMGalZyIUQ+1UN/dhrOZNRJwXU8B4r/eWhVoJf3f3bCuNfpMoT2LN3HY4ooyu37VehD+J5bdDsvlNPw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
|
"@budibase/bbui" "^0.9.133"
|
||||||
"@spectrum-css/actionbutton" "^1.0.1"
|
"@budibase/standard-components" "^0.9.133"
|
||||||
"@spectrum-css/actiongroup" "^1.0.1"
|
"@budibase/string-templates" "^0.9.133"
|
||||||
"@spectrum-css/avatar" "^3.0.2"
|
|
||||||
"@spectrum-css/button" "^3.0.1"
|
|
||||||
"@spectrum-css/buttongroup" "^3.0.2"
|
|
||||||
"@spectrum-css/checkbox" "^3.0.2"
|
|
||||||
"@spectrum-css/dialog" "^3.0.1"
|
|
||||||
"@spectrum-css/divider" "^1.0.3"
|
|
||||||
"@spectrum-css/dropzone" "^3.0.2"
|
|
||||||
"@spectrum-css/fieldgroup" "^3.0.2"
|
|
||||||
"@spectrum-css/fieldlabel" "^3.0.1"
|
|
||||||
"@spectrum-css/icon" "^3.0.1"
|
|
||||||
"@spectrum-css/illustratedmessage" "^3.0.2"
|
|
||||||
"@spectrum-css/inputgroup" "^3.0.2"
|
|
||||||
"@spectrum-css/label" "^2.0.10"
|
|
||||||
"@spectrum-css/link" "^3.1.1"
|
|
||||||
"@spectrum-css/menu" "^3.0.1"
|
|
||||||
"@spectrum-css/modal" "^3.0.1"
|
|
||||||
"@spectrum-css/pagination" "^3.0.3"
|
|
||||||
"@spectrum-css/picker" "^1.0.1"
|
|
||||||
"@spectrum-css/popover" "^3.0.1"
|
|
||||||
"@spectrum-css/progressbar" "^1.0.2"
|
|
||||||
"@spectrum-css/progresscircle" "^1.0.2"
|
|
||||||
"@spectrum-css/radio" "^3.0.2"
|
|
||||||
"@spectrum-css/search" "^3.0.2"
|
|
||||||
"@spectrum-css/sidenav" "^3.0.2"
|
|
||||||
"@spectrum-css/statuslight" "^3.0.2"
|
|
||||||
"@spectrum-css/stepper" "^3.0.3"
|
|
||||||
"@spectrum-css/switch" "^1.0.2"
|
|
||||||
"@spectrum-css/table" "^3.0.1"
|
|
||||||
"@spectrum-css/tabs" "^3.0.1"
|
|
||||||
"@spectrum-css/tags" "^3.0.2"
|
|
||||||
"@spectrum-css/textfield" "^3.0.1"
|
|
||||||
"@spectrum-css/toast" "^3.0.1"
|
|
||||||
"@spectrum-css/tooltip" "^3.0.3"
|
|
||||||
"@spectrum-css/treeview" "^3.0.2"
|
|
||||||
"@spectrum-css/typography" "^3.0.1"
|
|
||||||
"@spectrum-css/underlay" "^2.0.9"
|
|
||||||
"@spectrum-css/vars" "^3.0.1"
|
|
||||||
dayjs "^1.10.4"
|
|
||||||
svelte-flatpickr "^3.1.0"
|
|
||||||
svelte-portal "^1.0.0"
|
|
||||||
|
|
||||||
"@budibase/client@^0.9.125-alpha.11":
|
|
||||||
version "0.9.130"
|
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.9.130.tgz#efff68349667ad315cda2973d530cfe8a30b10d3"
|
|
||||||
integrity sha512-PJiOqEf7QF2/MS5CK9WkJl5JYSz/IBDQ1/H665V4Q1Kf5Y/hL+ymXaC5ztWPt6CZlo6dSoAZaD81h7zd6XeuYA==
|
|
||||||
dependencies:
|
|
||||||
"@budibase/bbui" "^0.9.130"
|
|
||||||
"@budibase/standard-components" "^0.9.130"
|
|
||||||
"@budibase/string-templates" "^0.9.130"
|
|
||||||
regexparam "^1.3.0"
|
regexparam "^1.3.0"
|
||||||
shortid "^2.2.15"
|
shortid "^2.2.15"
|
||||||
svelte-spa-router "^3.0.5"
|
svelte-spa-router "^3.0.5"
|
||||||
|
@ -1104,12 +1055,12 @@
|
||||||
to-gfm-code-block "^0.1.1"
|
to-gfm-code-block "^0.1.1"
|
||||||
year "^0.2.1"
|
year "^0.2.1"
|
||||||
|
|
||||||
"@budibase/standard-components@^0.9.124":
|
"@budibase/standard-components@^0.9.133":
|
||||||
version "0.9.127"
|
version "0.9.133"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.127.tgz#91366b8376eb388f8bcab16e96a2913e4b4af649"
|
resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.133.tgz#789c02b45dc3853b003822c09e18ce7ece4dfa29"
|
||||||
integrity sha512-NlJB+y28/gKRu1FtTZQzEifJNA7N8suaZ8FlZpqh4Aq/LzRh0Q301BXx1emVnPqMW/fEHBum47iRYboO5XSmMA==
|
integrity sha512-xcuwTxsqk1J/YmM4YjThO/Fm0eJ+aZWm0kbFgfN+dNN9fuPlsPOLmlVEWeOUPmBa5XfRyDbx6lDYj0PPEK8CvA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/bbui" "^0.9.127"
|
"@budibase/bbui" "^0.9.133"
|
||||||
"@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"
|
||||||
|
@ -1122,28 +1073,10 @@
|
||||||
svelte-apexcharts "^1.0.2"
|
svelte-apexcharts "^1.0.2"
|
||||||
svelte-flatpickr "^3.1.0"
|
svelte-flatpickr "^3.1.0"
|
||||||
|
|
||||||
"@budibase/standard-components@^0.9.130":
|
"@budibase/string-templates@^0.9.125-alpha.17", "@budibase/string-templates@^0.9.133":
|
||||||
version "0.9.130"
|
version "0.9.133"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.130.tgz#ed24eaafcca959e15c76b81e2340371d268ab131"
|
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.133.tgz#221d81e080dc4485dcffa989d16e2bbed39f9055"
|
||||||
integrity sha512-hsLKnVciI+is6L42IDDcZ8sW/aLD0UyYLQd/hqMZT8WBf58908ujY3nwFZnxV30uwjSmiZeYCYmK3vbHDD0ljQ==
|
integrity sha512-SMHcSPwHYdAqol9YCcMoYawp5/ETr9TqGZCUsL+hUUq+LritPwu/miQ++SVvRTQbOR7Mker0S9LO3H8mwYkW8w==
|
||||||
dependencies:
|
|
||||||
"@budibase/bbui" "^0.9.130"
|
|
||||||
"@spectrum-css/button" "^3.0.3"
|
|
||||||
"@spectrum-css/card" "^3.0.3"
|
|
||||||
"@spectrum-css/divider" "^1.0.3"
|
|
||||||
"@spectrum-css/link" "^3.1.3"
|
|
||||||
"@spectrum-css/page" "^3.0.1"
|
|
||||||
"@spectrum-css/typography" "^3.0.2"
|
|
||||||
"@spectrum-css/vars" "^3.0.1"
|
|
||||||
apexcharts "^3.22.1"
|
|
||||||
dayjs "^1.10.5"
|
|
||||||
svelte-apexcharts "^1.0.2"
|
|
||||||
svelte-flatpickr "^3.1.0"
|
|
||||||
|
|
||||||
"@budibase/string-templates@^0.9.125-alpha.11", "@budibase/string-templates@^0.9.130":
|
|
||||||
version "0.9.130"
|
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.130.tgz#1be8affcba0dc8ff2b8044c65dd378dc76a165d0"
|
|
||||||
integrity sha512-DXO6Um18/k16i3hYilxvQ4RYNHhd29OJGbzjfQZ2v7z4Oin5y+WMZzpjX1hQS5g9f/CBbzu7qd7EHiz/n8gMqg==
|
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/handlebars-helpers" "^0.11.4"
|
"@budibase/handlebars-helpers" "^0.11.4"
|
||||||
dayjs "^1.10.4"
|
dayjs "^1.10.4"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "0.9.125-alpha.14",
|
"version": "0.9.125-alpha.17",
|
||||||
"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",
|
||||||
|
|
|
@ -19,6 +19,13 @@ const HELPERS = [
|
||||||
}),
|
}),
|
||||||
// this help is applied to all statements
|
// this help is applied to all statements
|
||||||
new Helper(HelperFunctionNames.ALL, value => {
|
new Helper(HelperFunctionNames.ALL, value => {
|
||||||
|
if (
|
||||||
|
value != null &&
|
||||||
|
typeof value === "object" &&
|
||||||
|
value.toString() === "[object Object]"
|
||||||
|
) {
|
||||||
|
return new SafeString(JSON.stringify(value))
|
||||||
|
}
|
||||||
// null/undefined values produce bad results
|
// null/undefined values produce bad results
|
||||||
if (value == null || typeof value !== "string") {
|
if (value == null || typeof value !== "string") {
|
||||||
return value || ""
|
return value || ""
|
||||||
|
|
|
@ -81,6 +81,16 @@ describe("Test that the object processing works correctly", () => {
|
||||||
expect(error).not.toBeNull()
|
expect(error).not.toBeNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("check objects get converted to string JSON automatically", async () => {
|
||||||
|
const row = {a: 1}
|
||||||
|
const output = await processString("{{ trigger.row }}", {
|
||||||
|
trigger: {
|
||||||
|
row,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
expect(JSON.parse(output)).toEqual(row)
|
||||||
|
})
|
||||||
|
|
||||||
it("should be able to handle null objects", async () => {
|
it("should be able to handle null objects", async () => {
|
||||||
let error = null
|
let error = null
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/worker",
|
"name": "@budibase/worker",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "0.9.125-alpha.14",
|
"version": "0.9.125-alpha.17",
|
||||||
"description": "Budibase background service",
|
"description": "Budibase background service",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -25,8 +25,8 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/auth": "^0.9.125-alpha.14",
|
"@budibase/auth": "^0.9.125-alpha.17",
|
||||||
"@budibase/string-templates": "^0.9.125-alpha.14",
|
"@budibase/string-templates": "^0.9.125-alpha.17",
|
||||||
"@koa/router": "^8.0.0",
|
"@koa/router": "^8.0.0",
|
||||||
"@techpass/passport-openidconnect": "^0.3.0",
|
"@techpass/passport-openidconnect": "^0.3.0",
|
||||||
"aws-sdk": "^2.811.0",
|
"aws-sdk": "^2.811.0",
|
||||||
|
|
|
@ -96,7 +96,7 @@ exports.reset = async ctx => {
|
||||||
exports.resetUpdate = async ctx => {
|
exports.resetUpdate = async ctx => {
|
||||||
const { resetCode, password } = ctx.request.body
|
const { resetCode, password } = ctx.request.body
|
||||||
try {
|
try {
|
||||||
const userId = await checkResetPasswordCode(resetCode)
|
const { userId } = await checkResetPasswordCode(resetCode)
|
||||||
const db = getGlobalDB()
|
const db = getGlobalDB()
|
||||||
const user = await db.get(userId)
|
const user = await db.get(userId)
|
||||||
user.password = await hash(password)
|
user.password = await hash(password)
|
||||||
|
|
|
@ -6,13 +6,11 @@ const {
|
||||||
} = require("@budibase/auth/db")
|
} = require("@budibase/auth/db")
|
||||||
const { hash, getGlobalUserByEmail } = require("@budibase/auth").utils
|
const { hash, getGlobalUserByEmail } = require("@budibase/auth").utils
|
||||||
const { UserStatus, EmailTemplatePurpose } = require("../../../constants")
|
const { UserStatus, EmailTemplatePurpose } = require("../../../constants")
|
||||||
const { DEFAULT_TENANT_ID } = require("@budibase/auth/constants")
|
|
||||||
const { checkInviteCode } = require("../../../utilities/redis")
|
const { checkInviteCode } = require("../../../utilities/redis")
|
||||||
const { sendEmail } = require("../../../utilities/email")
|
const { sendEmail } = require("../../../utilities/email")
|
||||||
const { user: userCache } = require("@budibase/auth/cache")
|
const { user: userCache } = require("@budibase/auth/cache")
|
||||||
const { invalidateSessions } = require("@budibase/auth/sessions")
|
const { invalidateSessions } = require("@budibase/auth/sessions")
|
||||||
const CouchDB = require("../../../db")
|
const CouchDB = require("../../../db")
|
||||||
const env = require("../../../environment")
|
|
||||||
const {
|
const {
|
||||||
getGlobalDB,
|
getGlobalDB,
|
||||||
getTenantId,
|
getTenantId,
|
||||||
|
@ -251,25 +249,14 @@ exports.find = async ctx => {
|
||||||
ctx.body = user
|
ctx.body = user
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.tenantLookup = async ctx => {
|
exports.tenantUserLookup = async ctx => {
|
||||||
const id = ctx.params.id
|
const id = ctx.params.id
|
||||||
// lookup, could be email or userId, either will return a doc
|
// lookup, could be email or userId, either will return a doc
|
||||||
const db = new CouchDB(PLATFORM_INFO_DB)
|
const db = new CouchDB(PLATFORM_INFO_DB)
|
||||||
let tenantId = null
|
|
||||||
try {
|
try {
|
||||||
const doc = await db.get(id)
|
ctx.body = await db.get(id)
|
||||||
if (doc && doc.tenantId) {
|
|
||||||
tenantId = doc.tenantId
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!env.MULTI_TENANCY) {
|
ctx.throw(400, "No tenant user found.")
|
||||||
tenantId = DEFAULT_TENANT_ID
|
|
||||||
} else {
|
|
||||||
ctx.throw(400, "No tenant found.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ctx.body = {
|
|
||||||
tenantId,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ router
|
||||||
controller.adminUser
|
controller.adminUser
|
||||||
)
|
)
|
||||||
.get("/api/global/users/self", controller.getSelf)
|
.get("/api/global/users/self", controller.getSelf)
|
||||||
.get("/api/global/users/tenant/:id", controller.tenantLookup)
|
.get("/api/global/users/tenant/:id", controller.tenantUserLookup)
|
||||||
// global endpoint but needs to come at end (blocks other endpoints otherwise)
|
// global endpoint but needs to come at end (blocks other endpoints otherwise)
|
||||||
.get("/api/global/users/:id", adminOnly, controller.find)
|
.get("/api/global/users/:id", adminOnly, controller.find)
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ function createSMTPTransport(config) {
|
||||||
async function getLinkCode(purpose, email, user, info = null) {
|
async function getLinkCode(purpose, email, user, info = null) {
|
||||||
switch (purpose) {
|
switch (purpose) {
|
||||||
case EmailTemplatePurpose.PASSWORD_RECOVERY:
|
case EmailTemplatePurpose.PASSWORD_RECOVERY:
|
||||||
return getResetPasswordCode(user._id)
|
return getResetPasswordCode(user._id, info)
|
||||||
case EmailTemplatePurpose.INVITATION:
|
case EmailTemplatePurpose.INVITATION:
|
||||||
return getInviteCode(email, info)
|
return getInviteCode(email, info)
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -63,8 +63,8 @@ exports.shutdown = async () => {
|
||||||
* @param {string} userId the ID of the user which is to be reset.
|
* @param {string} userId the ID of the user which is to be reset.
|
||||||
* @return {Promise<string>} returns the code that was stored to redis.
|
* @return {Promise<string>} returns the code that was stored to redis.
|
||||||
*/
|
*/
|
||||||
exports.getResetPasswordCode = async userId => {
|
exports.getResetPasswordCode = async (userId, info) => {
|
||||||
return writeACode(utils.Databases.PW_RESETS, userId)
|
return writeACode(utils.Databases.PW_RESETS, { userId, info })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue