@budibase/worker 2.21.5 → 2.21.7
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.21.
|
|
4
|
+
"version": "2.21.7",
|
|
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.21.
|
|
41
|
-
"@budibase/pro": "2.21.
|
|
42
|
-
"@budibase/string-templates": "2.21.
|
|
43
|
-
"@budibase/types": "2.21.
|
|
40
|
+
"@budibase/backend-core": "2.21.7",
|
|
41
|
+
"@budibase/pro": "2.21.7",
|
|
42
|
+
"@budibase/string-templates": "2.21.7",
|
|
43
|
+
"@budibase/types": "2.21.7",
|
|
44
44
|
"@koa/router": "8.0.8",
|
|
45
45
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
46
46
|
"@types/global-agent": "2.1.1",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "52831511d4af1629ac5fae34e6709d1bf1f32ed8"
|
|
112
112
|
}
|
|
@@ -10,25 +10,20 @@ import {
|
|
|
10
10
|
import { TestConfiguration } from "../../../../tests"
|
|
11
11
|
import { events } from "@budibase/backend-core"
|
|
12
12
|
|
|
13
|
-
// this test can 409 - retries reduce issues with this
|
|
14
|
-
jest.retryTimes(2, { logErrorsBeforeRetry: true })
|
|
15
13
|
jest.setTimeout(30000)
|
|
16
14
|
|
|
17
15
|
describe("scim", () => {
|
|
18
|
-
|
|
19
|
-
tk.freeze(mocks.date.MOCK_DATE)
|
|
20
|
-
mocks.licenses.useScimIntegration()
|
|
21
|
-
|
|
22
|
-
await config.setSCIMConfig(true)
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
beforeEach(async () => {
|
|
16
|
+
async function setup() {
|
|
26
17
|
jest.resetAllMocks()
|
|
27
18
|
tk.freeze(mocks.date.MOCK_DATE)
|
|
28
19
|
mocks.licenses.useScimIntegration()
|
|
20
|
+
mocks.licenses.useGroups()
|
|
29
21
|
|
|
30
22
|
await config.setSCIMConfig(true)
|
|
31
|
-
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
beforeAll(setup)
|
|
26
|
+
beforeEach(setup)
|
|
32
27
|
|
|
33
28
|
const config = new TestConfiguration()
|
|
34
29
|
|
|
@@ -367,13 +362,77 @@ describe("scim", () => {
|
|
|
367
362
|
})
|
|
368
363
|
})
|
|
369
364
|
|
|
370
|
-
it("creating an
|
|
371
|
-
const body =
|
|
365
|
+
it("creating an external user that conflicts an internal one syncs the existing user", async () => {
|
|
366
|
+
const { body: internalUser } = await config.api.users.saveUser(
|
|
367
|
+
structures.users.user()
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
const scimUserData = {
|
|
371
|
+
externalId: structures.uuid(),
|
|
372
|
+
email: internalUser.email,
|
|
373
|
+
firstName: structures.generator.first(),
|
|
374
|
+
lastName: structures.generator.last(),
|
|
375
|
+
username: structures.generator.name(),
|
|
376
|
+
}
|
|
377
|
+
const scimUserRequest = structures.scim.createUserRequest(scimUserData)
|
|
378
|
+
|
|
379
|
+
const res = await postScimUser(
|
|
380
|
+
{ body: scimUserRequest },
|
|
381
|
+
{ expect: 200 }
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
const expectedScimUser: ScimUserResponse = {
|
|
385
|
+
schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"],
|
|
386
|
+
id: internalUser._id!,
|
|
387
|
+
externalId: scimUserRequest.externalId,
|
|
388
|
+
meta: {
|
|
389
|
+
resourceType: "User",
|
|
390
|
+
// @ts-ignore
|
|
391
|
+
created: mocks.date.MOCK_DATE.toISOString(),
|
|
392
|
+
// @ts-ignore
|
|
393
|
+
lastModified: mocks.date.MOCK_DATE.toISOString(),
|
|
394
|
+
},
|
|
395
|
+
userName: scimUserData.username,
|
|
396
|
+
name: {
|
|
397
|
+
formatted: `${scimUserData.firstName} ${scimUserData.lastName}`,
|
|
398
|
+
familyName: scimUserData.lastName,
|
|
399
|
+
givenName: scimUserData.firstName,
|
|
400
|
+
},
|
|
401
|
+
active: true,
|
|
402
|
+
emails: [
|
|
403
|
+
{
|
|
404
|
+
value: internalUser.email,
|
|
405
|
+
type: "work",
|
|
406
|
+
primary: true,
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
expect(res).toEqual(expectedScimUser)
|
|
412
|
+
})
|
|
372
413
|
|
|
373
|
-
|
|
414
|
+
it("a user cannot be SCIM synchronised with another SCIM user", async () => {
|
|
415
|
+
const { body: internalUser } = await config.api.users.saveUser(
|
|
416
|
+
structures.users.user()
|
|
417
|
+
)
|
|
374
418
|
|
|
375
|
-
|
|
376
|
-
|
|
419
|
+
await postScimUser(
|
|
420
|
+
{
|
|
421
|
+
body: structures.scim.createUserRequest({
|
|
422
|
+
email: internalUser.email,
|
|
423
|
+
}),
|
|
424
|
+
},
|
|
425
|
+
{ expect: 200 }
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
await postScimUser(
|
|
429
|
+
{
|
|
430
|
+
body: structures.scim.createUserRequest({
|
|
431
|
+
email: internalUser.email,
|
|
432
|
+
}),
|
|
433
|
+
},
|
|
434
|
+
{ expect: 409 }
|
|
435
|
+
)
|
|
377
436
|
})
|
|
378
437
|
})
|
|
379
438
|
|
|
@@ -656,7 +715,6 @@ describe("scim", () => {
|
|
|
656
715
|
})
|
|
657
716
|
|
|
658
717
|
it("can fetch groups even if internal groups exist", async () => {
|
|
659
|
-
mocks.licenses.useGroups()
|
|
660
718
|
await config.api.groups.saveGroup(structures.userGroups.userGroup())
|
|
661
719
|
await config.api.groups.saveGroup(structures.userGroups.userGroup())
|
|
662
720
|
|
|
@@ -722,6 +780,43 @@ describe("scim", () => {
|
|
|
722
780
|
)
|
|
723
781
|
})
|
|
724
782
|
})
|
|
783
|
+
|
|
784
|
+
it("creating an external group that conflicts an internal one syncs the existing group", async () => {
|
|
785
|
+
const groupToSave = structures.userGroups.userGroup()
|
|
786
|
+
const { body: internalGroup } = await config.api.groups.saveGroup(
|
|
787
|
+
groupToSave
|
|
788
|
+
)
|
|
789
|
+
|
|
790
|
+
const scimGroupData = {
|
|
791
|
+
externalId: structures.uuid(),
|
|
792
|
+
displayName: groupToSave.name,
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
const res = await postScimGroup(
|
|
796
|
+
{ body: structures.scim.createGroupRequest(scimGroupData) },
|
|
797
|
+
{ expect: 200 }
|
|
798
|
+
)
|
|
799
|
+
|
|
800
|
+
expect(res).toEqual(
|
|
801
|
+
expect.objectContaining({
|
|
802
|
+
id: internalGroup._id!,
|
|
803
|
+
externalId: scimGroupData.externalId,
|
|
804
|
+
displayName: scimGroupData.displayName,
|
|
805
|
+
})
|
|
806
|
+
)
|
|
807
|
+
})
|
|
808
|
+
|
|
809
|
+
it("a group cannot be SCIM synchronised with another SCIM group", async () => {
|
|
810
|
+
const groupToSave = structures.userGroups.userGroup()
|
|
811
|
+
await config.api.groups.saveGroup(groupToSave)
|
|
812
|
+
|
|
813
|
+
const createGroupRequest = structures.scim.createGroupRequest({
|
|
814
|
+
displayName: groupToSave.name,
|
|
815
|
+
})
|
|
816
|
+
await postScimGroup({ body: createGroupRequest }, { expect: 200 })
|
|
817
|
+
|
|
818
|
+
await postScimGroup({ body: createGroupRequest }, { expect: 409 })
|
|
819
|
+
})
|
|
725
820
|
})
|
|
726
821
|
|
|
727
822
|
describe("GET /api/global/scim/v2/groups/:id", () => {
|