@budibase/worker 2.7.34-alpha.9 → 2.7.36-alpha.1
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.7.
|
|
4
|
+
"version": "2.7.36-alpha.1",
|
|
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.7.
|
|
42
|
-
"@budibase/pro": "2.7.
|
|
43
|
-
"@budibase/string-templates": "2.7.
|
|
44
|
-
"@budibase/types": "2.7.
|
|
41
|
+
"@budibase/backend-core": "2.7.36-alpha.1",
|
|
42
|
+
"@budibase/pro": "2.7.36-alpha.1",
|
|
43
|
+
"@budibase/string-templates": "2.7.36-alpha.1",
|
|
44
|
+
"@budibase/types": "2.7.36-alpha.1",
|
|
45
45
|
"@koa/router": "8.0.8",
|
|
46
46
|
"@sentry/node": "6.17.7",
|
|
47
47
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"typescript": "4.7.3",
|
|
106
106
|
"update-dotenv": "1.1.1"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "8d3bbb718b4e3dea5e1da2dfa30fac231ef4fe22"
|
|
109
109
|
}
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
SSOConfig,
|
|
29
29
|
SSOConfigType,
|
|
30
30
|
UserCtx,
|
|
31
|
+
OIDCLogosConfig,
|
|
31
32
|
} from "@budibase/types"
|
|
32
33
|
import * as pro from "@budibase/pro"
|
|
33
34
|
|
|
@@ -280,13 +281,39 @@ export async function save(ctx: UserCtx<Config>) {
|
|
|
280
281
|
}
|
|
281
282
|
}
|
|
282
283
|
|
|
284
|
+
function enrichOIDCLogos(oidcLogos: OIDCLogosConfig) {
|
|
285
|
+
if (!oidcLogos) {
|
|
286
|
+
return
|
|
287
|
+
}
|
|
288
|
+
oidcLogos.config = Object.keys(oidcLogos.config || {}).reduce(
|
|
289
|
+
(acc: any, key: string) => {
|
|
290
|
+
if (!key.endsWith("Etag")) {
|
|
291
|
+
const etag = oidcLogos.config[`${key}Etag`]
|
|
292
|
+
const objectStoreUrl = objectStore.getGlobalFileUrl(
|
|
293
|
+
oidcLogos.type,
|
|
294
|
+
key,
|
|
295
|
+
etag
|
|
296
|
+
)
|
|
297
|
+
acc[key] = objectStoreUrl
|
|
298
|
+
} else {
|
|
299
|
+
acc[key] = oidcLogos.config[key]
|
|
300
|
+
}
|
|
301
|
+
return acc
|
|
302
|
+
},
|
|
303
|
+
{}
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
|
|
283
307
|
export async function find(ctx: UserCtx) {
|
|
284
308
|
try {
|
|
285
309
|
// Find the config with the most granular scope based on context
|
|
286
310
|
const type = ctx.params.type
|
|
287
|
-
|
|
311
|
+
let scopedConfig = await configs.getConfig(type)
|
|
288
312
|
|
|
289
313
|
if (scopedConfig) {
|
|
314
|
+
if (type === ConfigType.OIDC_LOGOS) {
|
|
315
|
+
enrichOIDCLogos(scopedConfig)
|
|
316
|
+
}
|
|
290
317
|
ctx.body = scopedConfig
|
|
291
318
|
} else {
|
|
292
319
|
// don't throw an error, there simply is nothing to return
|
|
@@ -300,16 +327,21 @@ export async function find(ctx: UserCtx) {
|
|
|
300
327
|
export async function publicOidc(ctx: Ctx<void, GetPublicOIDCConfigResponse>) {
|
|
301
328
|
try {
|
|
302
329
|
// Find the config with the most granular scope based on context
|
|
303
|
-
const
|
|
330
|
+
const oidcConfig = await configs.getOIDCConfig()
|
|
331
|
+
const oidcCustomLogos = await configs.getOIDCLogosDoc()
|
|
332
|
+
|
|
333
|
+
if (oidcCustomLogos) {
|
|
334
|
+
enrichOIDCLogos(oidcCustomLogos)
|
|
335
|
+
}
|
|
304
336
|
|
|
305
|
-
if (!
|
|
337
|
+
if (!oidcConfig) {
|
|
306
338
|
ctx.body = []
|
|
307
339
|
} else {
|
|
308
340
|
ctx.body = [
|
|
309
341
|
{
|
|
310
|
-
logo: config.logo,
|
|
311
|
-
name:
|
|
312
|
-
uuid:
|
|
342
|
+
logo: oidcCustomLogos?.config[oidcConfig.logo] ?? oidcConfig.logo,
|
|
343
|
+
name: oidcConfig.name,
|
|
344
|
+
uuid: oidcConfig.uuid,
|
|
313
345
|
},
|
|
314
346
|
]
|
|
315
347
|
}
|
|
@@ -19,6 +19,7 @@ jest.mock("@budibase/backend-core", () => {
|
|
|
19
19
|
|
|
20
20
|
let appId: string
|
|
21
21
|
let appDb: Database
|
|
22
|
+
const ROLE_NAME = "newRole"
|
|
22
23
|
|
|
23
24
|
async function addAppMetadata() {
|
|
24
25
|
await appDb.put({
|
|
@@ -34,7 +35,7 @@ describe("/api/global/roles", () => {
|
|
|
34
35
|
const config = new TestConfiguration()
|
|
35
36
|
|
|
36
37
|
const role = new roles.Role(
|
|
37
|
-
db.generateRoleID(
|
|
38
|
+
db.generateRoleID(ROLE_NAME),
|
|
38
39
|
roles.BUILTIN_ROLE_IDS.BASIC,
|
|
39
40
|
permissions.BuiltinPermissionID.READ_ONLY
|
|
40
41
|
)
|
|
@@ -66,7 +67,7 @@ describe("/api/global/roles", () => {
|
|
|
66
67
|
const res = await config.api.roles.get()
|
|
67
68
|
expect(res.body).toBeDefined()
|
|
68
69
|
expect(res.body[appId].roles.length).toEqual(5)
|
|
69
|
-
expect(res.body[appId].roles.map((r: any) => r._id)).toContain(
|
|
70
|
+
expect(res.body[appId].roles.map((r: any) => r._id)).toContain(ROLE_NAME)
|
|
70
71
|
})
|
|
71
72
|
})
|
|
72
73
|
|