@budibase/worker 3.2.39 → 3.2.41
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": "3.2.
|
|
4
|
+
"version": "3.2.41",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "53e10e4de05dd034dfae7e6b7e72a875b8ed99ea"
|
|
118
118
|
}
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
SaveUserResponse,
|
|
34
34
|
SearchUsersRequest,
|
|
35
35
|
SearchUsersResponse,
|
|
36
|
+
UnsavedUser,
|
|
36
37
|
UpdateInviteRequest,
|
|
37
38
|
UpdateInviteResponse,
|
|
38
39
|
User,
|
|
@@ -49,6 +50,7 @@ import {
|
|
|
49
50
|
tenancy,
|
|
50
51
|
db,
|
|
51
52
|
locks,
|
|
53
|
+
context,
|
|
52
54
|
} from "@budibase/backend-core"
|
|
53
55
|
import { checkAnyUserExists } from "../../../utilities/users"
|
|
54
56
|
import { isEmailConfigured } from "../../../utilities/email"
|
|
@@ -66,10 +68,11 @@ const generatePassword = (length: number) => {
|
|
|
66
68
|
.slice(0, length)
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
export const save = async (ctx: UserCtx<
|
|
71
|
+
export const save = async (ctx: UserCtx<UnsavedUser, SaveUserResponse>) => {
|
|
70
72
|
try {
|
|
71
73
|
const currentUserId = ctx.user?._id
|
|
72
|
-
const
|
|
74
|
+
const tenantId = context.getTenantId()
|
|
75
|
+
const requestUser: User = { ...ctx.request.body, tenantId }
|
|
73
76
|
|
|
74
77
|
// Do not allow the account holder role to be changed
|
|
75
78
|
if (
|
|
@@ -151,7 +154,12 @@ export const bulkUpdate = async (
|
|
|
151
154
|
let created, deleted
|
|
152
155
|
try {
|
|
153
156
|
if (input.create) {
|
|
154
|
-
|
|
157
|
+
const tenantId = context.getTenantId()
|
|
158
|
+
const users: User[] = input.create.users.map(user => ({
|
|
159
|
+
...user,
|
|
160
|
+
tenantId,
|
|
161
|
+
}))
|
|
162
|
+
created = await bulkCreate(users, input.create.groups)
|
|
155
163
|
}
|
|
156
164
|
if (input.delete) {
|
|
157
165
|
deleted = await bulkDelete(input.delete.users, currentUserId)
|