@budibase/worker 1.2.13 → 1.2.16
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": "1.2.
|
|
4
|
+
"version": "1.2.16",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"author": "Budibase",
|
|
36
36
|
"license": "GPL-3.0",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@budibase/backend-core": "^1.2.
|
|
39
|
-
"@budibase/pro": "1.2.
|
|
40
|
-
"@budibase/string-templates": "^1.2.
|
|
41
|
-
"@budibase/types": "^1.2.
|
|
38
|
+
"@budibase/backend-core": "^1.2.16",
|
|
39
|
+
"@budibase/pro": "1.2.15",
|
|
40
|
+
"@budibase/string-templates": "^1.2.16",
|
|
41
|
+
"@budibase/types": "^1.2.16",
|
|
42
42
|
"@koa/router": "8.0.8",
|
|
43
43
|
"@sentry/node": "6.17.7",
|
|
44
44
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"./scripts/jestSetup.js"
|
|
102
102
|
]
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "012a0d114ceb5687cf87e206dd29e01db708a7cf"
|
|
105
105
|
}
|
package/src/api/routes/index.js
CHANGED
|
@@ -6,7 +6,6 @@ const templateRoutes = require("./global/templates")
|
|
|
6
6
|
const emailRoutes = require("./global/email")
|
|
7
7
|
const authRoutes = require("./global/auth")
|
|
8
8
|
const roleRoutes = require("./global/roles")
|
|
9
|
-
const sessionRoutes = require("./global/sessions")
|
|
10
9
|
const environmentRoutes = require("./system/environment")
|
|
11
10
|
const tenantsRoutes = require("./system/tenants")
|
|
12
11
|
const statusRoutes = require("./system/status")
|
|
@@ -23,7 +22,6 @@ exports.routes = [
|
|
|
23
22
|
templateRoutes,
|
|
24
23
|
tenantsRoutes,
|
|
25
24
|
emailRoutes,
|
|
26
|
-
sessionRoutes,
|
|
27
25
|
roleRoutes,
|
|
28
26
|
environmentRoutes,
|
|
29
27
|
statusRoutes,
|
package/src/environment.js
CHANGED
|
@@ -61,6 +61,7 @@ module.exports = {
|
|
|
61
61
|
SMTP_FROM_ADDRESS: process.env.SMTP_FROM_ADDRESS,
|
|
62
62
|
// other
|
|
63
63
|
CHECKLIST_CACHE_TTL: parseIntSafe(process.env.CHECKLIST_CACHE_TTL) || 3600,
|
|
64
|
+
SESSION_UPDATE_PERIOD: process.env.SESSION_UPDATE_PERIOD,
|
|
64
65
|
_set(key, value) {
|
|
65
66
|
process.env[key] = value
|
|
66
67
|
module.exports[key] = value
|
package/src/sdk/users/users.ts
CHANGED
|
@@ -370,6 +370,7 @@ export const bulkDelete = async (userIds: any) => {
|
|
|
370
370
|
export const destroy = async (id: string, currentUser: any) => {
|
|
371
371
|
const db = tenancy.getGlobalDB()
|
|
372
372
|
const dbUser = await db.get(id)
|
|
373
|
+
const userId = dbUser._id as string
|
|
373
374
|
let groups = dbUser.userGroups
|
|
374
375
|
|
|
375
376
|
if (!env.SELF_HOSTED && !env.DISABLE_ACCOUNT_PORTAL) {
|
|
@@ -387,7 +388,7 @@ export const destroy = async (id: string, currentUser: any) => {
|
|
|
387
388
|
|
|
388
389
|
await deprovisioning.removeUserFromInfoDB(dbUser)
|
|
389
390
|
|
|
390
|
-
await db.remove(
|
|
391
|
+
await db.remove(userId, dbUser._rev)
|
|
391
392
|
|
|
392
393
|
if (groups) {
|
|
393
394
|
await groupUtils.deleteGroupUsers(groups, dbUser)
|
|
@@ -395,17 +396,18 @@ export const destroy = async (id: string, currentUser: any) => {
|
|
|
395
396
|
|
|
396
397
|
await eventHelpers.handleDeleteEvents(dbUser)
|
|
397
398
|
await quotas.removeUser(dbUser)
|
|
398
|
-
await cache.user.invalidateUser(
|
|
399
|
-
await sessions.invalidateSessions(
|
|
399
|
+
await cache.user.invalidateUser(userId)
|
|
400
|
+
await sessions.invalidateSessions(userId, { reason: "deletion" })
|
|
400
401
|
// let server know to sync user
|
|
401
|
-
await apps.syncUserInApps(
|
|
402
|
+
await apps.syncUserInApps(userId)
|
|
402
403
|
}
|
|
403
404
|
|
|
404
405
|
const bulkDeleteProcessing = async (dbUser: User) => {
|
|
406
|
+
const userId = dbUser._id as string
|
|
405
407
|
await deprovisioning.removeUserFromInfoDB(dbUser)
|
|
406
408
|
await eventHelpers.handleDeleteEvents(dbUser)
|
|
407
|
-
await cache.user.invalidateUser(
|
|
408
|
-
await sessions.invalidateSessions(
|
|
409
|
+
await cache.user.invalidateUser(userId)
|
|
410
|
+
await sessions.invalidateSessions(userId, { reason: "bulk-deletion" })
|
|
409
411
|
// let server know to sync user
|
|
410
|
-
await apps.syncUserInApps(
|
|
412
|
+
await apps.syncUserInApps(userId)
|
|
411
413
|
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const {
|
|
2
|
-
getAllSessions,
|
|
3
|
-
getUserSessions,
|
|
4
|
-
invalidateSessions,
|
|
5
|
-
} = require("@budibase/backend-core/sessions")
|
|
6
|
-
|
|
7
|
-
exports.fetch = async ctx => {
|
|
8
|
-
ctx.body = await getAllSessions()
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
exports.find = async ctx => {
|
|
12
|
-
const { userId } = ctx.params
|
|
13
|
-
const sessions = await getUserSessions(userId)
|
|
14
|
-
ctx.body = sessions.map(session => session.value)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.invalidateUser = async ctx => {
|
|
18
|
-
const { userId } = ctx.params
|
|
19
|
-
await invalidateSessions(userId)
|
|
20
|
-
ctx.body = {
|
|
21
|
-
message: "User sessions invalidated",
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
exports.selfSessions = async ctx => {
|
|
26
|
-
const userId = ctx.user._id
|
|
27
|
-
ctx.body = await getUserSessions(userId)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
exports.invalidateSession = async ctx => {
|
|
31
|
-
const userId = ctx.user._id
|
|
32
|
-
const { sessionId } = ctx.params
|
|
33
|
-
await invalidateSessions(userId, sessionId)
|
|
34
|
-
ctx.body = {
|
|
35
|
-
message: "Session invalidated successfully.",
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const Router = require("@koa/router")
|
|
2
|
-
const controller = require("../../controllers/global/sessions")
|
|
3
|
-
const { adminOnly } = require("@budibase/backend-core/auth")
|
|
4
|
-
|
|
5
|
-
const router = Router()
|
|
6
|
-
|
|
7
|
-
router
|
|
8
|
-
.get("/api/global/sessions", adminOnly, controller.fetch)
|
|
9
|
-
.get("/api/global/sessions/self", controller.selfSessions)
|
|
10
|
-
.get("/api/global/sessions/:userId", adminOnly, controller.find)
|
|
11
|
-
.delete("/api/global/sessions/:userId", adminOnly, controller.invalidateUser)
|
|
12
|
-
.delete("/api/global/sessions/self/:sessionId", controller.invalidateSession)
|
|
13
|
-
|
|
14
|
-
module.exports = router
|