@budibase/worker 2.27.4 → 2.27.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/worker",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.27.
|
|
4
|
+
"version": "2.27.6",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"author": "Budibase",
|
|
38
38
|
"license": "GPL-3.0",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@budibase/backend-core": "2.27.
|
|
41
|
-
"@budibase/pro": "2.27.
|
|
42
|
-
"@budibase/string-templates": "2.27.
|
|
43
|
-
"@budibase/types": "2.27.
|
|
40
|
+
"@budibase/backend-core": "2.27.6",
|
|
41
|
+
"@budibase/pro": "2.27.6",
|
|
42
|
+
"@budibase/string-templates": "2.27.6",
|
|
43
|
+
"@budibase/types": "2.27.6",
|
|
44
44
|
"@koa/router": "8.0.8",
|
|
45
45
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
46
46
|
"@types/global-agent": "2.1.1",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"global-agent": "3.0.0",
|
|
54
54
|
"ical-generator": "4.1.0",
|
|
55
55
|
"joi": "17.6.0",
|
|
56
|
+
"knex": "2.4.2",
|
|
56
57
|
"koa": "2.13.4",
|
|
57
58
|
"koa-body": "4.2.0",
|
|
58
59
|
"koa-compress": "4.0.1",
|
|
@@ -108,5 +109,5 @@
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
},
|
|
111
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "67671b9dfc8698315cb394a427266a4d184b0e26"
|
|
112
113
|
}
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
CreateAdminUserRequest,
|
|
11
11
|
CreateAdminUserResponse,
|
|
12
12
|
Ctx,
|
|
13
|
+
DeleteInviteUserRequest,
|
|
14
|
+
DeleteInviteUsersRequest,
|
|
13
15
|
InviteUserRequest,
|
|
14
16
|
InviteUsersRequest,
|
|
15
17
|
InviteUsersResponse,
|
|
@@ -35,6 +37,7 @@ import {
|
|
|
35
37
|
} from "@budibase/backend-core"
|
|
36
38
|
import { checkAnyUserExists } from "../../../utilities/users"
|
|
37
39
|
import { isEmailConfigured } from "../../../utilities/email"
|
|
40
|
+
import { BpmStatusKey, BpmStatusValue } from "@budibase/shared-core"
|
|
38
41
|
|
|
39
42
|
const MAX_USERS_UPLOAD_LIMIT = 1000
|
|
40
43
|
|
|
@@ -334,6 +337,20 @@ export const inviteMultiple = async (ctx: Ctx<InviteUsersRequest>) => {
|
|
|
334
337
|
ctx.body = await userSdk.invite(ctx.request.body)
|
|
335
338
|
}
|
|
336
339
|
|
|
340
|
+
export const removeMultipleInvites = async (
|
|
341
|
+
ctx: Ctx<DeleteInviteUsersRequest>
|
|
342
|
+
) => {
|
|
343
|
+
const inviteCodesToRemove = ctx.request.body.map(
|
|
344
|
+
(invite: DeleteInviteUserRequest) => invite.code
|
|
345
|
+
)
|
|
346
|
+
for (const code of inviteCodesToRemove) {
|
|
347
|
+
await cache.invite.deleteCode(code)
|
|
348
|
+
}
|
|
349
|
+
ctx.body = {
|
|
350
|
+
message: "User invites successfully removed.",
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
337
354
|
export const checkInvite = async (ctx: any) => {
|
|
338
355
|
const { code } = ctx.params
|
|
339
356
|
let invite
|
|
@@ -444,10 +461,16 @@ export const inviteAccept = async (
|
|
|
444
461
|
|
|
445
462
|
await cache.invite.deleteCode(inviteCode)
|
|
446
463
|
|
|
464
|
+
// make sure onboarding flow is cleared
|
|
465
|
+
ctx.cookies.set(BpmStatusKey.ONBOARDING, BpmStatusValue.COMPLETED, {
|
|
466
|
+
expires: new Date(0),
|
|
467
|
+
})
|
|
468
|
+
|
|
447
469
|
ctx.body = {
|
|
448
470
|
_id: user._id!,
|
|
449
471
|
_rev: user._rev!,
|
|
450
472
|
email: user.email,
|
|
473
|
+
tenantId: user.tenantId,
|
|
451
474
|
}
|
|
452
475
|
}
|
|
453
476
|
)
|
package/src/api/index.ts
CHANGED
|
@@ -4,8 +4,13 @@ const compress = require("koa-compress")
|
|
|
4
4
|
|
|
5
5
|
import zlib from "zlib"
|
|
6
6
|
import { routes } from "./routes"
|
|
7
|
-
import { middleware as pro } from "@budibase/pro"
|
|
7
|
+
import { middleware as pro, sdk } from "@budibase/pro"
|
|
8
8
|
import { auth, middleware } from "@budibase/backend-core"
|
|
9
|
+
import env from "../environment"
|
|
10
|
+
|
|
11
|
+
if (env.SQS_SEARCH_ENABLE) {
|
|
12
|
+
sdk.auditLogs.useSQLSearch()
|
|
13
|
+
}
|
|
9
14
|
|
|
10
15
|
const PUBLIC_ENDPOINTS = [
|
|
11
16
|
// deprecated single tenant sso callback
|
|
@@ -100,16 +105,20 @@ const NO_TENANCY_ENDPOINTS = [
|
|
|
100
105
|
route: "/api/admin/auth/oidc/callback",
|
|
101
106
|
method: "GET",
|
|
102
107
|
},
|
|
108
|
+
// global user search - no tenancy
|
|
109
|
+
// :id is user id
|
|
110
|
+
// TODO: this should really be `/api/system/users/:id`
|
|
111
|
+
{
|
|
112
|
+
route: "/api/global/users/tenant/:id",
|
|
113
|
+
method: "GET",
|
|
114
|
+
},
|
|
103
115
|
// tenant is determined from code in redis
|
|
104
116
|
{
|
|
105
117
|
route: "/api/global/users/invite/accept",
|
|
106
118
|
method: "POST",
|
|
107
119
|
},
|
|
108
|
-
// global user search - no tenancy
|
|
109
|
-
// :id is user id
|
|
110
|
-
// TODO: this should really be `/api/system/users/:id`
|
|
111
120
|
{
|
|
112
|
-
route: "/api/global/users/
|
|
121
|
+
route: "/api/global/users/invite/:code",
|
|
113
122
|
method: "GET",
|
|
114
123
|
},
|
|
115
124
|
]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mocks, structures } from "@budibase/backend-core/tests"
|
|
2
2
|
import { context, events } from "@budibase/backend-core"
|
|
3
3
|
import { Event, IdentityType } from "@budibase/types"
|
|
4
|
+
import { auditLogs } from "@budibase/pro"
|
|
4
5
|
import { TestConfiguration } from "../../../../tests"
|
|
5
6
|
|
|
6
7
|
mocks.licenses.useAuditLogs()
|
|
@@ -12,10 +13,13 @@ const BASE_IDENTITY = {
|
|
|
12
13
|
const USER_AUDIT_LOG_COUNT = 3
|
|
13
14
|
const APP_ID = "app_1"
|
|
14
15
|
|
|
15
|
-
describe("/api/global/auditlogs
|
|
16
|
+
describe.each(["lucene", "sql"])("/api/global/auditlogs (%s)", method => {
|
|
16
17
|
const config = new TestConfiguration()
|
|
17
18
|
|
|
18
19
|
beforeAll(async () => {
|
|
20
|
+
if (method === "sql") {
|
|
21
|
+
auditLogs.useSQLSearch()
|
|
22
|
+
}
|
|
19
23
|
await config.beforeAll()
|
|
20
24
|
})
|
|
21
25
|
|
|
@@ -108,6 +108,11 @@ router
|
|
|
108
108
|
buildInviteMultipleValidation(),
|
|
109
109
|
controller.inviteMultiple
|
|
110
110
|
)
|
|
111
|
+
.post(
|
|
112
|
+
"/api/global/users/multi/invite/delete",
|
|
113
|
+
auth.builderOrAdmin,
|
|
114
|
+
controller.removeMultipleInvites
|
|
115
|
+
)
|
|
111
116
|
|
|
112
117
|
// non-global endpoints
|
|
113
118
|
.get("/api/global/users/invite/:code", controller.checkInvite)
|
package/src/environment.ts
CHANGED
|
@@ -45,6 +45,7 @@ const environment = {
|
|
|
45
45
|
DISABLE_ACCOUNT_PORTAL: process.env.DISABLE_ACCOUNT_PORTAL,
|
|
46
46
|
SMTP_FALLBACK_ENABLED: process.env.SMTP_FALLBACK_ENABLED,
|
|
47
47
|
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
|
|
48
|
+
SQS_SEARCH_ENABLE: process.env.SQS_SEARCH_ENABLE,
|
|
48
49
|
// smtp
|
|
49
50
|
SMTP_USER: process.env.SMTP_USER,
|
|
50
51
|
SMTP_PASSWORD: process.env.SMTP_PASSWORD,
|