diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsPanel.svelte
index 17eadb99bd..affa115ca2 100644
--- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsPanel.svelte
+++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsPanel.svelte
@@ -91,7 +91,12 @@
/>
{/if}
{#if section == "styles"}
-
+
{
+ const getSections = (instance, definition, isScreen, tag) => {
const settings = definition?.settings ?? []
- const generalSettings = settings.filter(setting => !setting.section)
- const customSections = settings.filter(setting => setting.section)
+ const generalSettings = settings.filter(
+ setting => !setting.section && setting.tag === tag
+ )
+ const customSections = settings.filter(
+ setting => setting.section && setting.tag === tag
+ )
let sections = [
- {
- name: "General",
- settings: generalSettings,
- },
+ ...(generalSettings?.length
+ ? [
+ {
+ name: "General",
+ settings: generalSettings,
+ },
+ ]
+ : []),
...(customSections || []),
]
@@ -132,7 +146,7 @@
- {:else if idx === 0 && section.name === "General" && componentDefinition.info}
+ {:else if idx === 0 && section.name === "General" && componentDefinition?.info && !tag}
{/if}
{/each}
-{#if componentDefinition?.block}
+{#if componentDefinition?.block && !tag}
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/DesignSection.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/DesignSection.svelte
index 444ded7e1f..def1fcf24b 100644
--- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/DesignSection.svelte
+++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/DesignSection.svelte
@@ -1,10 +1,12 @@
+
+
+
{#if styles?.length > 0}
{#each styles as style}
{
expect(res.body.length).toBe(1)
expect(res.body[0]).toBe("PUBLIC")
})
+
+ it("should not fetch higher level accessible roles when a custom role header is provided", async () => {
+ await createRole({
+ name: `CUSTOM_ROLE`,
+ inherits: roles.BUILTIN_ROLE_IDS.BASIC,
+ permissionId: permissions.BuiltinPermissionID.READ_ONLY,
+ version: "name",
+ })
+ const res = await request
+ .get("/api/roles/accessible")
+ .set({
+ ...config.defaultHeaders(),
+ "x-budibase-role": "CUSTOM_ROLE"
+ })
+ .expect(200)
+ expect(res.body.length).toBe(3)
+ expect(res.body[0]).toBe("CUSTOM_ROLE")
+ expect(res.body[1]).toBe("BASIC")
+ expect(res.body[2]).toBe("PUBLIC")
+ })
})
})
diff --git a/packages/server/src/api/routes/tests/routing.spec.js b/packages/server/src/api/routes/tests/routing.spec.js
index ff6d7aba1d..4076f4879c 100644
--- a/packages/server/src/api/routes/tests/routing.spec.js
+++ b/packages/server/src/api/routes/tests/routing.spec.js
@@ -1,5 +1,5 @@
const setup = require("./utilities")
-const { basicScreen } = setup.structures
+const { basicScreen, powerScreen } = setup.structures
const { checkBuilderEndpoint, runInProd } = require("./utilities/TestFunctions")
const { roles } = require("@budibase/backend-core")
const { BUILTIN_ROLE_IDS } = roles
@@ -12,19 +12,14 @@ const route = "/test"
describe("/routing", () => {
let request = setup.getRequest()
let config = setup.getConfig()
- let screen, screen2
+ let basic, power
afterAll(setup.afterAll)
beforeAll(async () => {
await config.init()
- screen = basicScreen()
- screen.routing.route = route
- screen = await config.createScreen(screen)
- screen2 = basicScreen()
- screen2.routing.roleId = BUILTIN_ROLE_IDS.POWER
- screen2.routing.route = route
- screen2 = await config.createScreen(screen2)
+ basic = await config.createScreen(basicScreen(route))
+ power = await config.createScreen(powerScreen(route))
await config.publish()
})
@@ -61,8 +56,8 @@ describe("/routing", () => {
expect(res.body.routes[route]).toEqual({
subpaths: {
[route]: {
- screenId: screen._id,
- roleId: screen.routing.roleId
+ screenId: basic._id,
+ roleId: basic.routing.roleId
}
}
})
@@ -80,8 +75,8 @@ describe("/routing", () => {
expect(res.body.routes[route]).toEqual({
subpaths: {
[route]: {
- screenId: screen2._id,
- roleId: screen2.routing.roleId
+ screenId: power._id,
+ roleId: power.routing.roleId
}
}
})
@@ -101,8 +96,8 @@ describe("/routing", () => {
expect(res.body.routes).toBeDefined()
expect(res.body.routes[route].subpaths[route]).toBeDefined()
const subpath = res.body.routes[route].subpaths[route]
- expect(subpath.screens[screen2.routing.roleId]).toEqual(screen2._id)
- expect(subpath.screens[screen.routing.roleId]).toEqual(screen._id)
+ expect(subpath.screens[power.routing.roleId]).toEqual(power._id)
+ expect(subpath.screens[basic.routing.roleId]).toEqual(basic._id)
})
it("make sure it is a builder only endpoint", async () => {
diff --git a/packages/server/src/constants/screens.ts b/packages/server/src/constants/screens.ts
index 23e36a65b8..6c88b0f957 100644
--- a/packages/server/src/constants/screens.ts
+++ b/packages/server/src/constants/screens.ts
@@ -1,7 +1,15 @@
import { roles } from "@budibase/backend-core"
import { BASE_LAYOUT_PROP_IDS } from "./layouts"
-export function createHomeScreen() {
+export function createHomeScreen(
+ config: {
+ roleId: string
+ route: string
+ } = {
+ roleId: roles.BUILTIN_ROLE_IDS.BASIC,
+ route: "/",
+ }
+) {
return {
description: "",
url: "",
@@ -40,8 +48,8 @@ export function createHomeScreen() {
gap: "M",
},
routing: {
- route: "/",
- roleId: roles.BUILTIN_ROLE_IDS.BASIC,
+ route: config.route,
+ roleId: config.roleId,
},
name: "home-screen",
}
diff --git a/packages/server/src/tests/utilities/structures.ts b/packages/server/src/tests/utilities/structures.ts
index d3e92ea34d..6d236062a8 100644
--- a/packages/server/src/tests/utilities/structures.ts
+++ b/packages/server/src/tests/utilities/structures.ts
@@ -20,6 +20,7 @@ import {
SourceName,
Table,
} from "@budibase/types"
+const { BUILTIN_ROLE_IDS } = roles
export function basicTable(): Table {
return {
@@ -322,8 +323,22 @@ export function basicUser(role: string) {
}
}
-export function basicScreen() {
- return createHomeScreen()
+export function basicScreen(route: string = "/") {
+ return createHomeScreen({
+ roleId: BUILTIN_ROLE_IDS.BASIC,
+ route,
+ })
+}
+
+export function powerScreen(route: string = "/") {
+ return createHomeScreen({
+ roleId: BUILTIN_ROLE_IDS.POWER,
+ route,
+ })
+}
+
+export function customScreen(config: { roleId: string; route: string }) {
+ return createHomeScreen(config)
}
export function basicLayout() {