@budibase/worker 3.34.0 → 3.34.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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/worker",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "3.34.
|
|
4
|
+
"version": "3.34.2",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"supertest": "6.3.3",
|
|
92
92
|
"timekeeper": "2.2.0"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "4d4c308333cb78bd5454f322f983dc0da62e5505"
|
|
95
95
|
}
|
|
@@ -45,6 +45,26 @@ async function updateAppMetadata(
|
|
|
45
45
|
})
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
async function addUsersTable(roleInclusion: string[]) {
|
|
49
|
+
await workspaceDb.put({
|
|
50
|
+
_id: "ta_users",
|
|
51
|
+
type: "table",
|
|
52
|
+
name: "Users",
|
|
53
|
+
sourceType: "internal",
|
|
54
|
+
sourceId: "bb_internal",
|
|
55
|
+
schema: {
|
|
56
|
+
roleId: {
|
|
57
|
+
name: "roleId",
|
|
58
|
+
type: "options",
|
|
59
|
+
constraints: {
|
|
60
|
+
type: "string",
|
|
61
|
+
inclusion: roleInclusion,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
48
68
|
describe("/api/global/roles", () => {
|
|
49
69
|
const config = new TestConfiguration()
|
|
50
70
|
|
|
@@ -102,6 +122,44 @@ describe("/api/global/roles", () => {
|
|
|
102
122
|
}
|
|
103
123
|
)
|
|
104
124
|
|
|
125
|
+
it("includes POWER role for v3+ apps when users table references POWER with custom roles", async () => {
|
|
126
|
+
await updateAppMetadata({ creationVersion: "3.0.0" })
|
|
127
|
+
await addUsersTable([
|
|
128
|
+
roles.BUILTIN_ROLE_IDS.ADMIN,
|
|
129
|
+
roles.BUILTIN_ROLE_IDS.POWER,
|
|
130
|
+
roles.BUILTIN_ROLE_IDS.BASIC,
|
|
131
|
+
roles.BUILTIN_ROLE_IDS.PUBLIC,
|
|
132
|
+
ROLE_NAME,
|
|
133
|
+
])
|
|
134
|
+
const res = await config.api.roles.get()
|
|
135
|
+
|
|
136
|
+
expect(res.body[workspaceId].roles.map((r: any) => r._id)).toEqual([
|
|
137
|
+
ROLE_NAME,
|
|
138
|
+
roles.BUILTIN_ROLE_IDS.ADMIN,
|
|
139
|
+
roles.BUILTIN_ROLE_IDS.POWER,
|
|
140
|
+
roles.BUILTIN_ROLE_IDS.BASIC,
|
|
141
|
+
roles.BUILTIN_ROLE_IDS.PUBLIC,
|
|
142
|
+
])
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
it("does not include POWER for v3+ apps when users table only has builtin roles", async () => {
|
|
146
|
+
await updateAppMetadata({ creationVersion: "3.0.0" })
|
|
147
|
+
await addUsersTable([
|
|
148
|
+
roles.BUILTIN_ROLE_IDS.ADMIN,
|
|
149
|
+
roles.BUILTIN_ROLE_IDS.POWER,
|
|
150
|
+
roles.BUILTIN_ROLE_IDS.BASIC,
|
|
151
|
+
roles.BUILTIN_ROLE_IDS.PUBLIC,
|
|
152
|
+
])
|
|
153
|
+
const res = await config.api.roles.get()
|
|
154
|
+
|
|
155
|
+
expect(res.body[workspaceId].roles.map((r: any) => r._id)).toEqual([
|
|
156
|
+
ROLE_NAME,
|
|
157
|
+
roles.BUILTIN_ROLE_IDS.ADMIN,
|
|
158
|
+
roles.BUILTIN_ROLE_IDS.BASIC,
|
|
159
|
+
roles.BUILTIN_ROLE_IDS.PUBLIC,
|
|
160
|
+
])
|
|
161
|
+
})
|
|
162
|
+
|
|
105
163
|
it.each(["2.9.0", "1.0.0", "0.0.0", "2.32.17+2146.b125a7c"])(
|
|
106
164
|
"include POWER roles before v3 (%s)",
|
|
107
165
|
async creationVersion => {
|