@budibase/worker 1.3.19 → 1.3.20
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.3.
|
|
4
|
+
"version": "1.3.20",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"author": "Budibase",
|
|
37
37
|
"license": "GPL-3.0",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@budibase/backend-core": "^1.3.
|
|
40
|
-
"@budibase/pro": "1.3.
|
|
41
|
-
"@budibase/string-templates": "^1.3.
|
|
42
|
-
"@budibase/types": "^1.3.
|
|
39
|
+
"@budibase/backend-core": "^1.3.20",
|
|
40
|
+
"@budibase/pro": "1.3.19",
|
|
41
|
+
"@budibase/string-templates": "^1.3.20",
|
|
42
|
+
"@budibase/types": "^1.3.20",
|
|
43
43
|
"@koa/router": "8.0.8",
|
|
44
44
|
"@sentry/node": "6.17.7",
|
|
45
45
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"./scripts/jestSetup.js"
|
|
105
105
|
]
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "463d6238d270324638761183110f61dd0e448508"
|
|
108
108
|
}
|
|
@@ -80,16 +80,15 @@ const addSessionAttributesToUser = ctx => {
|
|
|
80
80
|
ctx.body.csrfToken = ctx.user.csrfToken
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
delete ctx.request.body.license
|
|
83
|
+
const sanitiseUserUpdate = ctx => {
|
|
84
|
+
const allowed = ["firstName", "lastName", "password", "forceResetPassword"]
|
|
85
|
+
const resp = {}
|
|
86
|
+
for (let [key, value] of Object.entries(ctx.request.body)) {
|
|
87
|
+
if (allowed.includes(key)) {
|
|
88
|
+
resp[key] = value
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return resp
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
exports.getSelf = async ctx => {
|
|
@@ -117,10 +116,12 @@ exports.updateSelf = async ctx => {
|
|
|
117
116
|
const db = getGlobalDB()
|
|
118
117
|
const user = await db.get(ctx.user._id)
|
|
119
118
|
let passwordChange = false
|
|
120
|
-
|
|
119
|
+
|
|
120
|
+
const userUpdateObj = sanitiseUserUpdate(ctx)
|
|
121
|
+
if (userUpdateObj.password) {
|
|
121
122
|
// changing password
|
|
122
123
|
passwordChange = true
|
|
123
|
-
|
|
124
|
+
userUpdateObj.password = await hash(userUpdateObj.password)
|
|
124
125
|
// Log all other sessions out apart from the current one
|
|
125
126
|
await platformLogout({
|
|
126
127
|
ctx,
|
|
@@ -128,14 +129,10 @@ exports.updateSelf = async ctx => {
|
|
|
128
129
|
keepActiveSession: true,
|
|
129
130
|
})
|
|
130
131
|
}
|
|
131
|
-
// don't allow sending up an ID/Rev, always use the existing one
|
|
132
|
-
delete ctx.request.body._id
|
|
133
|
-
delete ctx.request.body._rev
|
|
134
|
-
removeSessionAttributesFromUser(ctx)
|
|
135
132
|
|
|
136
133
|
const response = await db.put({
|
|
137
134
|
...user,
|
|
138
|
-
...
|
|
135
|
+
...userUpdateObj,
|
|
139
136
|
})
|
|
140
137
|
await userCache.invalidateUser(user._id)
|
|
141
138
|
ctx.body = {
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
errors,
|
|
15
15
|
events,
|
|
16
16
|
tenancy,
|
|
17
|
-
users as usersCore,
|
|
18
17
|
} from "@budibase/backend-core"
|
|
19
18
|
import { checkAnyUserExists } from "../../../utilities/users"
|
|
20
19
|
import { groups as groupUtils } from "@budibase/pro"
|
|
@@ -148,9 +147,7 @@ export const bulkDelete = async (ctx: any) => {
|
|
|
148
147
|
}
|
|
149
148
|
|
|
150
149
|
try {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
ctx.body = response
|
|
150
|
+
ctx.body = await users.bulkDelete(userIds)
|
|
154
151
|
} catch (err) {
|
|
155
152
|
ctx.throw(err)
|
|
156
153
|
}
|