@budibase/worker 3.30.0 → 3.30.2

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/Dockerfile CHANGED
@@ -7,7 +7,20 @@ LABEL com.centurylinklabs.watchtower.lifecycle.post-check="scripts/watchtower-ho
7
7
 
8
8
 
9
9
  # handle node-gyp
10
- RUN apk add --no-cache --virtual .gyp python3 make g++ jq
10
+ RUN apk add --no-cache --virtual .gyp python3 make g++ \
11
+ && apk add --no-cache \
12
+ jq \
13
+ procps \
14
+ iproute2 \
15
+ curl \
16
+ bind-tools \
17
+ netcat-openbsd \
18
+ openssl \
19
+ lsof \
20
+ strace \
21
+ less \
22
+ coreutils \
23
+ tzdata
11
24
  RUN yarn global add pm2
12
25
 
13
26
  WORKDIR /
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/worker",
3
3
  "email": "hi@budibase.com",
4
- "version": "3.30.0",
4
+ "version": "3.30.2",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -109,5 +109,5 @@
109
109
  }
110
110
  }
111
111
  },
112
- "gitHead": "58456cc695d2c71a354bcf5c064943b247ad4969"
112
+ "gitHead": "13dbc5b25ef09b4c6ae6ef16c6e16d7ef37f5589"
113
113
  }
@@ -20,9 +20,11 @@ export async function save(ctx: UserCtx) {
20
20
 
21
21
  // don't allow updating the roles through this endpoint
22
22
  delete group.roles
23
+ delete group.builder
23
24
  if (group._id) {
24
25
  const oldGroup = await groups.get(group._id)
25
26
  group.roles = oldGroup.roles
27
+ group.builder = oldGroup.builder
26
28
  group.scimInfo = oldGroup.scimInfo
27
29
  }
28
30
  const response = await groups.save(group)
@@ -4,13 +4,12 @@ import {
4
4
  context,
5
5
  db,
6
6
  events,
7
- HTTPError,
8
7
  locks,
9
8
  platform,
10
9
  tenancy,
11
10
  users,
12
11
  } from "@budibase/backend-core"
13
- import { features, groups as proGroups } from "@budibase/pro"
12
+ import { groups as proGroups } from "@budibase/pro"
14
13
  import { BpmStatusKey, BpmStatusValue, utils } from "@budibase/shared-core"
15
14
  import {
16
15
  AcceptUserInviteRequest,
@@ -800,10 +799,6 @@ async function handleUserWorkspacePermission(
800
799
  delete existingUser.roles[prodWorkspaceId]
801
800
  }
802
801
 
803
- if (role === "CREATOR" && !(await features.isAppBuildersEnabled())) {
804
- throw new HTTPError("Feature not enabled, please check license", 400)
805
- }
806
-
807
802
  const creatorForApps = Object.entries(existingUser.roles)
808
803
  .filter(([_appId, role]) => role === "CREATOR")
809
804
  .map(([appId]) => appId)
@@ -19,6 +19,9 @@ function buildGroupSaveValidation() {
19
19
  users: Joi.array().optional(),
20
20
  apps: Joi.array().optional(),
21
21
  roles: Joi.object().optional(),
22
+ builder: Joi.object({
23
+ apps: Joi.array().items(Joi.string()).optional(),
24
+ }).optional(),
22
25
  createdAt: Joi.string().optional(),
23
26
  updatedAt: Joi.string().optional(),
24
27
  }).required()
@@ -104,6 +104,40 @@ describe("/api/global/groups", () => {
104
104
  expect(events.group.permissionsEdited).not.toHaveBeenCalled()
105
105
  })
106
106
 
107
+ it("should accept builder in save payload but not allow changing it", async () => {
108
+ const appId = "app_test123"
109
+ const updatedName = generator.guid()
110
+ const group = structures.groups.UserGroup()
111
+ const { body: savedGroup } = await config.api.groups.saveGroup(group)
112
+
113
+ await config.api.groups.updateGroupApps(savedGroup._id, {
114
+ add: [{ appId, roleId: "CREATOR" }],
115
+ remove: [],
116
+ })
117
+
118
+ const { body: groupWithBuilder } = await config.api.groups.find(
119
+ savedGroup._id
120
+ )
121
+ expect(groupWithBuilder.builder.apps).toEqual([appId])
122
+
123
+ await config.api.groups.saveGroup(
124
+ {
125
+ ...groupWithBuilder,
126
+ name: updatedName,
127
+ builder: {
128
+ apps: ["app_different"],
129
+ },
130
+ },
131
+ { expect: 200 }
132
+ )
133
+
134
+ const { body: updatedGroup } = await config.api.groups.find(
135
+ savedGroup._id
136
+ )
137
+ expect(updatedGroup.name).toEqual(updatedName)
138
+ expect(updatedGroup.builder.apps).toEqual([appId])
139
+ })
140
+
107
141
  describe("scim", () => {
108
142
  async function createScimGroup() {
109
143
  mocks.licenses.useScimIntegration()
@@ -451,7 +485,6 @@ describe("/api/global/groups", () => {
451
485
  let group: UserGroup
452
486
 
453
487
  beforeEach(async () => {
454
- mocks.licenses.useAppBuilders()
455
488
  const groupResponse = await config.api.groups.saveGroup(
456
489
  structures.groups.UserGroup()
457
490
  )
@@ -1060,24 +1060,7 @@ describe("/api/global/users", () => {
1060
1060
  })
1061
1061
 
1062
1062
  describe("POST /api/global/users/:userId/permission/:role", () => {
1063
- it("should fail to assign CREATOR role when feature is not enabled", async () => {
1064
- const user = await config.createUser()
1065
- const workspaceId = "app_123456789"
1066
-
1067
- const res = await config.withApp(workspaceId, () =>
1068
- config.api.users.addUserToWorkspace(
1069
- user._id!,
1070
- user._rev!,
1071
- "CREATOR",
1072
- 400
1073
- )
1074
- )
1075
- expect(res.body.message).toBe("Feature not enabled, please check license")
1076
- })
1077
-
1078
1063
  it("should assign CREATOR role and set builder properties", async () => {
1079
- featureMocks.licenses.useAppBuilders()
1080
-
1081
1064
  const user = await config.createUser()
1082
1065
  const workspaceId = "app_123456789"
1083
1066
 
@@ -1113,8 +1096,6 @@ describe("/api/global/users", () => {
1113
1096
  })
1114
1097
 
1115
1098
  it("should keep builder creator flag when assigning CREATOR roles", async () => {
1116
- featureMocks.licenses.useAppBuilders()
1117
-
1118
1099
  const builderUser = await config.createUser({
1119
1100
  builder: {
1120
1101
  creator: true,
@@ -1137,7 +1118,6 @@ describe("/api/global/users", () => {
1137
1118
  })
1138
1119
 
1139
1120
  it("should maintain builder properties when user has multiple CREATOR roles", async () => {
1140
- mocks.licenses.useAppBuilders()
1141
1121
  const user = await config.createUser()
1142
1122
  const workspaceId1 = "app_111111111"
1143
1123
  const workspaceId2 = "app_222222222"