@budibase/worker 2.4.44-alpha.11 → 2.4.44-alpha.12
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.4.44-alpha.
|
|
4
|
+
"version": "2.4.44-alpha.12",
|
|
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.4.44-alpha.
|
|
41
|
-
"@budibase/pro": "2.4.44-alpha.
|
|
42
|
-
"@budibase/string-templates": "2.4.44-alpha.
|
|
43
|
-
"@budibase/types": "2.4.44-alpha.
|
|
40
|
+
"@budibase/backend-core": "2.4.44-alpha.12",
|
|
41
|
+
"@budibase/pro": "2.4.44-alpha.11",
|
|
42
|
+
"@budibase/string-templates": "2.4.44-alpha.12",
|
|
43
|
+
"@budibase/types": "2.4.44-alpha.12",
|
|
44
44
|
"@koa/router": "8.0.8",
|
|
45
45
|
"@sentry/node": "6.17.7",
|
|
46
46
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"typescript": "4.7.3",
|
|
103
103
|
"update-dotenv": "1.1.1"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "6c376568d6f2cc8d6836299a82261693ffec50dd"
|
|
106
106
|
}
|
|
@@ -318,6 +318,15 @@ describe("scim", () => {
|
|
|
318
318
|
await postScimUser({ body }, { expect: 500 })
|
|
319
319
|
})
|
|
320
320
|
})
|
|
321
|
+
|
|
322
|
+
it("creating an existing user name returns a conflict", async () => {
|
|
323
|
+
const body = structures.scim.createUserRequest()
|
|
324
|
+
|
|
325
|
+
await postScimUser({ body })
|
|
326
|
+
|
|
327
|
+
const res = await postScimUser({ body }, { expect: 409 })
|
|
328
|
+
expect((res as any).message).toBe("Email already in use")
|
|
329
|
+
})
|
|
321
330
|
})
|
|
322
331
|
|
|
323
332
|
describe("GET /api/global/scim/v2/users/:id", () => {
|
|
@@ -48,7 +48,7 @@ describe("/api/global/users", () => {
|
|
|
48
48
|
400
|
|
49
49
|
)
|
|
50
50
|
|
|
51
|
-
expect(res.body.message).toBe(
|
|
51
|
+
expect(res.body.message).toBe(`Unavailable`)
|
|
52
52
|
expect(sendMailMock).toHaveBeenCalledTimes(0)
|
|
53
53
|
expect(code).toBeUndefined()
|
|
54
54
|
expect(events.user.invited).toBeCalledTimes(0)
|
|
@@ -225,7 +225,9 @@ describe("/api/global/users", () => {
|
|
|
225
225
|
|
|
226
226
|
const response = await config.api.users.saveUser(user, 400)
|
|
227
227
|
|
|
228
|
-
expect(response.body.message).toBe(
|
|
228
|
+
expect(response.body.message).toBe(
|
|
229
|
+
`Email already in use: '${user.email}'`
|
|
230
|
+
)
|
|
229
231
|
expect(events.user.created).toBeCalledTimes(0)
|
|
230
232
|
})
|
|
231
233
|
|
|
@@ -237,7 +239,9 @@ describe("/api/global/users", () => {
|
|
|
237
239
|
delete user._id
|
|
238
240
|
const response = await config.api.users.saveUser(user, 400)
|
|
239
241
|
|
|
240
|
-
expect(response.body.message).toBe(
|
|
242
|
+
expect(response.body.message).toBe(
|
|
243
|
+
`Email already in use: '${user.email}'`
|
|
244
|
+
)
|
|
241
245
|
expect(events.user.created).toBeCalledTimes(0)
|
|
242
246
|
})
|
|
243
247
|
})
|
|
@@ -249,7 +253,9 @@ describe("/api/global/users", () => {
|
|
|
249
253
|
|
|
250
254
|
const response = await config.api.users.saveUser(user, 400)
|
|
251
255
|
|
|
252
|
-
expect(response.body.message).toBe(
|
|
256
|
+
expect(response.body.message).toBe(
|
|
257
|
+
`Email already in use: '${user.email}'`
|
|
258
|
+
)
|
|
253
259
|
expect(events.user.created).toBeCalledTimes(0)
|
|
254
260
|
})
|
|
255
261
|
|
package/src/sdk/users/users.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
ViewName,
|
|
17
17
|
env as coreEnv,
|
|
18
18
|
context,
|
|
19
|
+
EmailUnavailableError,
|
|
19
20
|
} from "@budibase/backend-core"
|
|
20
21
|
import {
|
|
21
22
|
AccountMetadata,
|
|
@@ -158,7 +159,7 @@ const validateUniqueUser = async (email: string, tenantId: string) => {
|
|
|
158
159
|
if (env.MULTI_TENANCY) {
|
|
159
160
|
const tenantUser = await getPlatformUser(email)
|
|
160
161
|
if (tenantUser != null && tenantUser.tenantId !== tenantId) {
|
|
161
|
-
throw
|
|
162
|
+
throw new EmailUnavailableError(email)
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
|
|
@@ -166,7 +167,7 @@ const validateUniqueUser = async (email: string, tenantId: string) => {
|
|
|
166
167
|
if (!env.SELF_HOSTED && !env.DISABLE_ACCOUNT_PORTAL) {
|
|
167
168
|
const account = await accounts.getAccount(email)
|
|
168
169
|
if (account && account.verified && account.tenantId !== tenantId) {
|
|
169
|
-
throw
|
|
170
|
+
throw new EmailUnavailableError(email)
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
}
|
|
@@ -235,7 +236,7 @@ export const save = async (
|
|
|
235
236
|
// no id was specified - load from email instead
|
|
236
237
|
dbUser = await usersCore.getGlobalUserByEmail(email)
|
|
237
238
|
if (dbUser && dbUser._id !== _id) {
|
|
238
|
-
throw
|
|
239
|
+
throw new EmailUnavailableError(email)
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
|