Linting.
This commit is contained in:
parent
7743384f77
commit
f3ce979230
|
@ -14,4 +14,4 @@ exports.StaticDatabases = {
|
||||||
tenants: "tenants",
|
tenants: "tenants",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
const { newid } = require("../hashing")
|
const { newid } = require("../hashing")
|
||||||
const Replication = require("./Replication")
|
const Replication = require("./Replication")
|
||||||
const { getDB } = require("./index")
|
|
||||||
const { DEFAULT_TENANT_ID } = require("../constants")
|
const { DEFAULT_TENANT_ID } = require("../constants")
|
||||||
const env = require("../environment")
|
const env = require("../environment")
|
||||||
const { StaticDatabases, SEPARATOR } = require("./constants")
|
const { StaticDatabases, SEPARATOR } = require("./constants")
|
||||||
|
|
|
@ -27,4 +27,4 @@ exports.matches = (ctx, options) => {
|
||||||
|
|
||||||
return urlMatch && methodMatch
|
return urlMatch && methodMatch
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
const {
|
const { createTenancyContext, setTenantId } = require("../tenancy")
|
||||||
createTenancyContext,
|
|
||||||
setTenantId,
|
|
||||||
} = require("../tenancy")
|
|
||||||
const { buildMatcherRegex, matches } = require("./matchers")
|
const { buildMatcherRegex, matches } = require("./matchers")
|
||||||
|
|
||||||
module.exports = (allowQueryStringPatterns, noTenancyPatterns) => {
|
module.exports = (allowQueryStringPatterns, noTenancyPatterns) => {
|
||||||
|
|
|
@ -84,4 +84,4 @@ exports.getTenantId = () => {
|
||||||
throw Error("Tenant id not found")
|
throw Error("Tenant id not found")
|
||||||
}
|
}
|
||||||
return tenantId
|
return tenantId
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ exports.getGlobalDB = (tenantId = null) => {
|
||||||
// tenant ID can be set externally, for example user API where
|
// tenant ID can be set externally, for example user API where
|
||||||
// new tenants are being created, this may be the case
|
// new tenants are being created, this may be the case
|
||||||
if (!tenantId) {
|
if (!tenantId) {
|
||||||
const tenantId = getTenantId()
|
tenantId = getTenantId()
|
||||||
}
|
}
|
||||||
|
|
||||||
let dbName
|
let dbName
|
||||||
|
@ -102,4 +102,4 @@ exports.lookupTenantId = async userId => {
|
||||||
// just return the default
|
// just return the default
|
||||||
}
|
}
|
||||||
return tenantId
|
return tenantId
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
const {
|
const { DocumentTypes, SEPARATOR, ViewNames } = require("./db/utils")
|
||||||
DocumentTypes,
|
|
||||||
SEPARATOR,
|
|
||||||
ViewNames,
|
|
||||||
} = require("./db/utils")
|
|
||||||
const jwt = require("jsonwebtoken")
|
const jwt = require("jsonwebtoken")
|
||||||
const { options } = require("./middleware/passport/jwt")
|
const { options } = require("./middleware/passport/jwt")
|
||||||
const { createUserEmailView } = require("./db/views")
|
const { createUserEmailView } = require("./db/views")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const Router = require("@koa/router")
|
const Router = require("@koa/router")
|
||||||
const { buildAuthMiddleware, auditLog, buildTenancyMiddleware } = require("@budibase/auth").auth
|
const { buildAuthMiddleware, auditLog, buildTenancyMiddleware } =
|
||||||
|
require("@budibase/auth").auth
|
||||||
const currentApp = require("../middleware/currentapp")
|
const currentApp = require("../middleware/currentapp")
|
||||||
const compress = require("koa-compress")
|
const compress = require("koa-compress")
|
||||||
const zlib = require("zlib")
|
const zlib = require("zlib")
|
||||||
|
|
|
@ -8,7 +8,11 @@ const { setCookie, getCookie, clearCookie, getGlobalUserByEmail, hash } =
|
||||||
const { Cookies } = authPkg.constants
|
const { Cookies } = authPkg.constants
|
||||||
const { passport } = authPkg.auth
|
const { passport } = authPkg.auth
|
||||||
const { checkResetPasswordCode } = require("../../../utilities/redis")
|
const { checkResetPasswordCode } = require("../../../utilities/redis")
|
||||||
const { getGlobalDB, getTenantId, isMultiTenant } = require("@budibase/auth/tenancy")
|
const {
|
||||||
|
getGlobalDB,
|
||||||
|
getTenantId,
|
||||||
|
isMultiTenant,
|
||||||
|
} = require("@budibase/auth/tenancy")
|
||||||
const env = require("../../../environment")
|
const env = require("../../../environment")
|
||||||
|
|
||||||
function googleCallbackUrl() {
|
function googleCallbackUrl() {
|
||||||
|
|
|
@ -2,15 +2,8 @@ const { sendEmail } = require("../../../utilities/email")
|
||||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||||
|
|
||||||
exports.sendEmail = async ctx => {
|
exports.sendEmail = async ctx => {
|
||||||
let {
|
let { workspaceId, email, userId, purpose, contents, from, subject } =
|
||||||
workspaceId,
|
ctx.request.body
|
||||||
email,
|
|
||||||
userId,
|
|
||||||
purpose,
|
|
||||||
contents,
|
|
||||||
from,
|
|
||||||
subject,
|
|
||||||
} = ctx.request.body
|
|
||||||
let user
|
let user
|
||||||
if (userId) {
|
if (userId) {
|
||||||
const db = getGlobalDB()
|
const db = getGlobalDB()
|
||||||
|
|
|
@ -330,13 +330,16 @@ exports.inviteAccept = async ctx => {
|
||||||
try {
|
try {
|
||||||
// info is an extension of the user object that was stored by global
|
// info is an extension of the user object that was stored by global
|
||||||
const { email, info } = await checkInviteCode(inviteCode)
|
const { email, info } = await checkInviteCode(inviteCode)
|
||||||
ctx.body = await saveUser({
|
ctx.body = await saveUser(
|
||||||
firstName,
|
{
|
||||||
lastName,
|
firstName,
|
||||||
password,
|
lastName,
|
||||||
email,
|
password,
|
||||||
...info,
|
email,
|
||||||
}, info.tenantId)
|
...info,
|
||||||
|
},
|
||||||
|
info.tenantId
|
||||||
|
)
|
||||||
// this will flesh out the body response
|
// this will flesh out the body response
|
||||||
await exports.save(ctx)
|
await exports.save(ctx)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
const {
|
const { getWorkspaceParams, generateWorkspaceID } = require("@budibase/auth/db")
|
||||||
getWorkspaceParams,
|
|
||||||
generateWorkspaceID,
|
|
||||||
} = require("@budibase/auth/db")
|
|
||||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||||
|
|
||||||
exports.save = async function (ctx) {
|
exports.save = async function (ctx) {
|
||||||
|
|
|
@ -2,7 +2,8 @@ const Router = require("@koa/router")
|
||||||
const compress = require("koa-compress")
|
const compress = require("koa-compress")
|
||||||
const zlib = require("zlib")
|
const zlib = require("zlib")
|
||||||
const { routes } = require("./routes")
|
const { routes } = require("./routes")
|
||||||
const { buildAuthMiddleware, auditLog, buildTenancyMiddleware } = require("@budibase/auth").auth
|
const { buildAuthMiddleware, auditLog, buildTenancyMiddleware } =
|
||||||
|
require("@budibase/auth").auth
|
||||||
|
|
||||||
const NO_TENANCY_ENDPOINTS = [
|
const NO_TENANCY_ENDPOINTS = [
|
||||||
{
|
{
|
||||||
|
@ -12,7 +13,7 @@ const NO_TENANCY_ENDPOINTS = [
|
||||||
{
|
{
|
||||||
route: "/api/global/users/self",
|
route: "/api/global/users/self",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const PUBLIC_ENDPOINTS = [
|
const PUBLIC_ENDPOINTS = [
|
||||||
|
|
|
@ -6,9 +6,7 @@ const {
|
||||||
GLOBAL_OWNER,
|
GLOBAL_OWNER,
|
||||||
} = require("../index")
|
} = require("../index")
|
||||||
const { join } = require("path")
|
const { join } = require("path")
|
||||||
const {
|
const { getTemplateParams } = require("@budibase/auth/db")
|
||||||
getTemplateParams,
|
|
||||||
} = require("@budibase/auth/db")
|
|
||||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||||
|
|
||||||
exports.EmailTemplates = {
|
exports.EmailTemplates = {
|
||||||
|
|
|
@ -68,12 +68,7 @@ async function getLinkCode(purpose, email, user, info = null) {
|
||||||
* @param {string|null} contents if using a custom template can supply contents for context.
|
* @param {string|null} contents if using a custom template can supply contents for context.
|
||||||
* @return {Promise<string>} returns the built email HTML if all provided parameters were valid.
|
* @return {Promise<string>} returns the built email HTML if all provided parameters were valid.
|
||||||
*/
|
*/
|
||||||
async function buildEmail(
|
async function buildEmail(purpose, email, context, { user, contents } = {}) {
|
||||||
purpose,
|
|
||||||
email,
|
|
||||||
context,
|
|
||||||
{ user, contents } = {}
|
|
||||||
) {
|
|
||||||
// this isn't a full email
|
// this isn't a full email
|
||||||
if (FULL_EMAIL_PURPOSES.indexOf(purpose) === -1) {
|
if (FULL_EMAIL_PURPOSES.indexOf(purpose) === -1) {
|
||||||
throw `Unable to build an email of type ${purpose}`
|
throw `Unable to build an email of type ${purpose}`
|
||||||
|
|
|
@ -44,9 +44,7 @@ exports.getSettingsTemplateContext = async (purpose, code = null) => {
|
||||||
case EmailTemplatePurpose.INVITATION:
|
case EmailTemplatePurpose.INVITATION:
|
||||||
context[InternalTemplateBindings.INVITE_CODE] = code
|
context[InternalTemplateBindings.INVITE_CODE] = code
|
||||||
context[InternalTemplateBindings.INVITE_URL] = checkSlashesInUrl(
|
context[InternalTemplateBindings.INVITE_URL] = checkSlashesInUrl(
|
||||||
addTenantToUrl(
|
addTenantToUrl(`${URL}/builder/invite?code=${code}`)
|
||||||
`${URL}/builder/invite?code=${code}`
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue