@budibase/worker 2.11.40 → 2.11.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": "2.11.40",
4
+ "version": "2.11.41",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -38,10 +38,10 @@
38
38
  "author": "Budibase",
39
39
  "license": "GPL-3.0",
40
40
  "dependencies": {
41
- "@budibase/backend-core": "2.11.40",
42
- "@budibase/pro": "2.11.40",
43
- "@budibase/string-templates": "2.11.40",
44
- "@budibase/types": "2.11.40",
41
+ "@budibase/backend-core": "2.11.41",
42
+ "@budibase/pro": "2.11.41",
43
+ "@budibase/string-templates": "2.11.41",
44
+ "@budibase/types": "2.11.41",
45
45
  "@koa/router": "8.0.8",
46
46
  "@techpass/passport-openidconnect": "0.3.2",
47
47
  "@types/global-agent": "2.1.1",
@@ -108,5 +108,5 @@
108
108
  }
109
109
  }
110
110
  },
111
- "gitHead": "386e2b81ef2ca25ee891f07be477723987dd9306"
111
+ "gitHead": "cfb21ffd5e3a748cd275a7fa91cb357e9df3973b"
112
112
  }
@@ -189,7 +189,10 @@ export const destroy = async (ctx: any) => {
189
189
 
190
190
  export const getAppUsers = async (ctx: Ctx<SearchUsersRequest>) => {
191
191
  const body = ctx.request.body
192
- const users = await userSdk.db.getUsersByAppAccess(body?.appId)
192
+ const users = await userSdk.db.getUsersByAppAccess({
193
+ appId: body.appId,
194
+ limit: body.limit,
195
+ })
193
196
 
194
197
  ctx.body = { data: users }
195
198
  }
@@ -569,9 +569,13 @@ describe("/api/global/users", () => {
569
569
  {
570
570
  query: { equal: { firstName: user.firstName } },
571
571
  },
572
- 501
572
+ { status: 501 }
573
573
  )
574
574
  })
575
+
576
+ it("should throw an error if public query performed", async () => {
577
+ await config.api.users.searchUsers({}, { status: 403, noHeaders: true })
578
+ })
575
579
  })
576
580
 
577
581
  describe("DELETE /api/global/users/:userId", () => {
@@ -72,7 +72,8 @@ router
72
72
  )
73
73
 
74
74
  .get("/api/global/users", auth.builderOrAdmin, controller.fetch)
75
- .post("/api/global/users/search", auth.builderOrAdmin, controller.search)
75
+ // search can be used by any user now, to retrieve users for user column
76
+ .post("/api/global/users/search", controller.search)
76
77
  .delete("/api/global/users/:id", auth.adminOnly, controller.destroy)
77
78
  .get(
78
79
  "/api/global/users/count/:appId",
@@ -134,13 +134,19 @@ export class UserAPI extends TestAPI {
134
134
  .expect(status ? status : 200)
135
135
  }
136
136
 
137
- searchUsers = ({ query }: { query?: SearchQuery }, status = 200) => {
138
- return this.request
137
+ searchUsers = (
138
+ { query }: { query?: SearchQuery },
139
+ opts?: { status?: number; noHeaders?: boolean }
140
+ ) => {
141
+ const req = this.request
139
142
  .post("/api/global/users/search")
140
- .set(this.config.defaultHeaders())
141
143
  .send({ query })
142
144
  .expect("Content-Type", /json/)
143
- .expect(status ? status : 200)
145
+ .expect(opts?.status ? opts.status : 200)
146
+ if (!opts?.noHeaders) {
147
+ req.set(this.config.defaultHeaders())
148
+ }
149
+ return req
144
150
  }
145
151
 
146
152
  getUser = (userId: string, opts?: TestAPIOpts) => {