@budibase/worker 2.21.7 → 2.21.8
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.8",
|
|
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.8",
|
|
41
|
+
"@budibase/pro": "2.21.8",
|
|
42
|
+
"@budibase/string-templates": "2.21.8",
|
|
43
|
+
"@budibase/types": "2.21.8",
|
|
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": "f2541bd150fcb84cd403e29a759843b2952563a4"
|
|
112
112
|
}
|
|
@@ -104,20 +104,82 @@ describe("/api/global/groups", () => {
|
|
|
104
104
|
expect(events.group.permissionsEdited).not.toBeCalled()
|
|
105
105
|
})
|
|
106
106
|
|
|
107
|
-
describe("
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
describe("scim", () => {
|
|
108
|
+
async function createScimGroup() {
|
|
109
|
+
mocks.licenses.useScimIntegration()
|
|
110
|
+
await config.setSCIMConfig(true)
|
|
111
|
+
|
|
112
|
+
const scimGroup = await config.api.scimGroupsAPI.post({
|
|
113
|
+
body: structures.scim.createGroupRequest({
|
|
114
|
+
displayName: generator.word(),
|
|
115
|
+
}),
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
const { body: group } = await config.api.groups.find(scimGroup.id)
|
|
119
|
+
|
|
120
|
+
expect(group).toBeDefined()
|
|
121
|
+
return group
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
it("update will not allow sending SCIM fields", async () => {
|
|
125
|
+
const group = await createScimGroup()
|
|
126
|
+
|
|
127
|
+
const updatedGroup: UserGroup = {
|
|
128
|
+
...group,
|
|
129
|
+
name: generator.word(),
|
|
130
|
+
}
|
|
131
|
+
await config.api.groups.saveGroup(updatedGroup, {
|
|
132
|
+
expect: {
|
|
133
|
+
message: 'Invalid body - "scimInfo" is not allowed',
|
|
134
|
+
status: 400,
|
|
135
|
+
},
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
expect(events.group.updated).not.toBeCalled()
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
it("update will not amend the SCIM fields", async () => {
|
|
142
|
+
const group: UserGroup = await createScimGroup()
|
|
143
|
+
|
|
144
|
+
const updatedGroup: UserGroup = {
|
|
145
|
+
...group,
|
|
146
|
+
name: generator.word(),
|
|
147
|
+
scimInfo: undefined,
|
|
148
|
+
}
|
|
115
149
|
|
|
116
|
-
|
|
150
|
+
await config.api.groups.saveGroup(updatedGroup, {
|
|
151
|
+
expect: 200,
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
expect(events.group.updated).toBeCalledTimes(1)
|
|
155
|
+
expect(
|
|
156
|
+
(
|
|
157
|
+
await config.api.groups.find(group._id!, {
|
|
158
|
+
expect: 200,
|
|
159
|
+
})
|
|
160
|
+
).body
|
|
161
|
+
).toEqual(
|
|
162
|
+
expect.objectContaining({
|
|
163
|
+
...group,
|
|
164
|
+
name: updatedGroup.name,
|
|
165
|
+
scimInfo: group.scimInfo,
|
|
166
|
+
_rev: expect.any(String),
|
|
167
|
+
})
|
|
168
|
+
)
|
|
117
169
|
})
|
|
118
170
|
})
|
|
119
171
|
})
|
|
120
172
|
|
|
173
|
+
describe("destroy", () => {
|
|
174
|
+
it("should be able to delete a basic group", async () => {
|
|
175
|
+
const group = structures.groups.UserGroup()
|
|
176
|
+
let oldGroup = await config.api.groups.saveGroup(group)
|
|
177
|
+
await config.api.groups.deleteGroup(oldGroup.body._id, oldGroup.body._rev)
|
|
178
|
+
|
|
179
|
+
expect(events.group.deleted).toBeCalledTimes(1)
|
|
180
|
+
})
|
|
181
|
+
})
|
|
182
|
+
|
|
121
183
|
describe("find users", () => {
|
|
122
184
|
describe("without users", () => {
|
|
123
185
|
let group: UserGroup
|
|
@@ -147,7 +209,7 @@ describe("/api/global/groups", () => {
|
|
|
147
209
|
|
|
148
210
|
await Promise.all(
|
|
149
211
|
Array.from({ length: 30 }).map(async (_, i) => {
|
|
150
|
-
const email = `user${i}@example.com`
|
|
212
|
+
const email = `user${i}+${generator.guid()}@example.com`
|
|
151
213
|
const user = await config.api.users.saveUser({
|
|
152
214
|
...structures.users.user(),
|
|
153
215
|
email,
|
|
@@ -257,12 +319,16 @@ describe("/api/global/groups", () => {
|
|
|
257
319
|
})
|
|
258
320
|
})
|
|
259
321
|
|
|
260
|
-
it("update should return
|
|
322
|
+
it("update should return forbidden", async () => {
|
|
261
323
|
await config.withUser(builder, async () => {
|
|
262
|
-
await config.api.groups.updateGroupUsers(
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
324
|
+
await config.api.groups.updateGroupUsers(
|
|
325
|
+
group._id!,
|
|
326
|
+
{
|
|
327
|
+
add: [builder._id!],
|
|
328
|
+
remove: [],
|
|
329
|
+
},
|
|
330
|
+
{ expect: 403 }
|
|
331
|
+
)
|
|
266
332
|
})
|
|
267
333
|
})
|
|
268
334
|
})
|
package/src/tests/api/groups.ts
CHANGED
|
@@ -7,7 +7,10 @@ export class GroupsAPI extends TestAPI {
|
|
|
7
7
|
super(config)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
saveGroup = (
|
|
10
|
+
saveGroup = (
|
|
11
|
+
group: UserGroup,
|
|
12
|
+
{ expect }: { expect: number | object } = { expect: 200 }
|
|
13
|
+
) => {
|
|
11
14
|
return this.request
|
|
12
15
|
.post(`/api/global/groups`)
|
|
13
16
|
.send(group)
|
|
@@ -44,14 +47,15 @@ export class GroupsAPI extends TestAPI {
|
|
|
44
47
|
|
|
45
48
|
updateGroupUsers = (
|
|
46
49
|
id: string,
|
|
47
|
-
body: { add: string[]; remove: string[] }
|
|
50
|
+
body: { add: string[]; remove: string[] },
|
|
51
|
+
{ expect } = { expect: 200 }
|
|
48
52
|
) => {
|
|
49
53
|
return this.request
|
|
50
54
|
.post(`/api/global/groups/${id}/users`)
|
|
51
55
|
.send(body)
|
|
52
56
|
.set(this.config.defaultHeaders())
|
|
53
57
|
.expect("Content-Type", /json/)
|
|
54
|
-
.expect(
|
|
58
|
+
.expect(expect)
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
fetch = ({ expect } = { expect: 200 }) => {
|
|
@@ -61,4 +65,12 @@ export class GroupsAPI extends TestAPI {
|
|
|
61
65
|
.expect("Content-Type", /json/)
|
|
62
66
|
.expect(expect)
|
|
63
67
|
}
|
|
68
|
+
|
|
69
|
+
find = (id: string, { expect } = { expect: 200 }) => {
|
|
70
|
+
return this.request
|
|
71
|
+
.get(`/api/global/groups/${id}`)
|
|
72
|
+
.set(this.config.defaultHeaders())
|
|
73
|
+
.expect("Content-Type", /json/)
|
|
74
|
+
.expect(expect)
|
|
75
|
+
}
|
|
64
76
|
}
|