switching to global builder role for plugin API, dis-allowing per app builders to delete apps and updating UI to reflect these updates.
This commit is contained in:
parent
d8f50f139e
commit
d62b2bdbe0
|
@ -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
|
||||
</script>
|
||||
|
@ -44,22 +46,24 @@
|
|||
url={$url("./version")}
|
||||
active={$isActive("./version")}
|
||||
/>
|
||||
<div class="delete-action">
|
||||
<AbsTooltip
|
||||
position={TooltipPosition.Bottom}
|
||||
text={$isOnlyUser
|
||||
? null
|
||||
: "Unavailable - another user is editing this app"}
|
||||
>
|
||||
<SideNavItem
|
||||
text="Delete app"
|
||||
disabled={!$isOnlyUser}
|
||||
on:click={() => {
|
||||
deleteModal.show()
|
||||
}}
|
||||
/>
|
||||
</AbsTooltip>
|
||||
</div>
|
||||
{#if sdk.users.isGlobalBuilder($auth.user)}
|
||||
<div class="delete-action">
|
||||
<AbsTooltip
|
||||
position={TooltipPosition.Bottom}
|
||||
text={$isOnlyUser
|
||||
? null
|
||||
: "Unavailable - another user is editing this app"}
|
||||
>
|
||||
<SideNavItem
|
||||
text="Delete app"
|
||||
disabled={!$isOnlyUser}
|
||||
on:click={() => {
|
||||
deleteModal.show()
|
||||
}}
|
||||
/>
|
||||
</AbsTooltip>
|
||||
</div>
|
||||
{/if}
|
||||
</SideNav>
|
||||
<slot />
|
||||
</Content>
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -55,7 +55,7 @@ router
|
|||
)
|
||||
.delete(
|
||||
"/api/applications/:appId",
|
||||
authorized(permissions.BUILDER),
|
||||
authorized(permissions.GLOBAL_BUILDER),
|
||||
controller.destroy
|
||||
)
|
||||
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue