diff --git a/packages/builder/src/pages/builder/app/[application]/settings/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/settings/_layout.svelte index 7063a271be..519a9c0f45 100644 --- a/packages/builder/src/pages/builder/app/[application]/settings/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/settings/_layout.svelte @@ -4,6 +4,8 @@ import { url, isActive } from "@roxi/routify" import DeleteModal from "components/deploy/DeleteModal.svelte" import { isOnlyUser } from "builderStore" + import { auth } from "stores/portal" + import { sdk } from "@budibase/shared-core" let deleteModal @@ -44,22 +46,24 @@ url={$url("./version")} active={$isActive("./version")} /> -
- - { - deleteModal.show() - }} - /> - -
+ {#if sdk.users.isGlobalBuilder($auth.user)} +
+ + { + deleteModal.show() + }} + /> + +
+ {/if} diff --git a/packages/builder/src/stores/portal/menu.js b/packages/builder/src/stores/portal/menu.js index 2c17ce0b36..f8e6264910 100644 --- a/packages/builder/src/stores/portal/menu.js +++ b/packages/builder/src/stores/portal/menu.js @@ -29,20 +29,17 @@ export const menu = derived([admin, auth], ([$admin, $auth]) => { href: "/builder/portal/apps", }, ] - if ( - sdk.users.hasBuilderPermissions(user) && - !sdk.users.hasAppBuilderPermissions(user) - ) { + if (sdk.users.isGlobalBuilder(user)) { menu.push({ title: "Users", href: "/builder/portal/users", subPages: userSubPages, }) + menu.push({ + title: "Plugins", + href: "/builder/portal/plugins", + }) } - menu.push({ - title: "Plugins", - href: "/builder/portal/plugins", - }) // Add settings page for admins if (isAdmin) { diff --git a/packages/server/src/api/routes/application.ts b/packages/server/src/api/routes/application.ts index 04d5f67b96..18760d485a 100644 --- a/packages/server/src/api/routes/application.ts +++ b/packages/server/src/api/routes/application.ts @@ -55,7 +55,7 @@ router ) .delete( "/api/applications/:appId", - authorized(permissions.BUILDER), + authorized(permissions.GLOBAL_BUILDER), controller.destroy ) diff --git a/packages/server/src/api/routes/plugin.ts b/packages/server/src/api/routes/plugin.ts index 70838c499e..b47f8e15cd 100644 --- a/packages/server/src/api/routes/plugin.ts +++ b/packages/server/src/api/routes/plugin.ts @@ -8,14 +8,18 @@ const router: Router = new Router() router .post( "/api/plugin/upload", - authorized(permissions.BUILDER), + authorized(permissions.GLOBAL_BUILDER), controller.upload ) - .post("/api/plugin", authorized(permissions.BUILDER), controller.create) - .get("/api/plugin", authorized(permissions.BUILDER), controller.fetch) + .post( + "/api/plugin", + authorized(permissions.GLOBAL_BUILDER), + controller.create + ) + .get("/api/plugin", authorized(permissions.GLOBAL_BUILDER), controller.fetch) .delete( "/api/plugin/:pluginId", - authorized(permissions.BUILDER), + authorized(permissions.GLOBAL_BUILDER), controller.destroy )