Only show edit button if user is a builder for this apps

This commit is contained in:
Andrew Kingston 2023-09-06 14:25:58 +01:00
parent fdfe09f8d0
commit de948f6065
1 changed files with 12 additions and 8 deletions

View File

@ -1,10 +1,12 @@
<script> <script>
import { params, goto } from "@roxi/routify" import { params, goto } from "@roxi/routify"
import { apps, sideBarCollapsed } from "stores/portal" import { apps, auth, sideBarCollapsed } from "stores/portal"
import { ActionButton } from "@budibase/bbui" import { ActionButton } from "@budibase/bbui"
import { sdk } from "@budibase/shared-core"
$: app = $apps.find(app => app.appId === $params.appId) $: app = $apps.find(app => app.appId === $params.appId)
$: iframeUrl = getIframeURL(app) $: iframeUrl = getIframeURL(app)
$: isBuilder = sdk.users.isBuilder($auth.user, app?.devId)
const getIframeURL = app => { const getIframeURL = app => {
if (app.status === "published") { if (app.status === "published") {
@ -33,6 +35,7 @@
Collapse Collapse
</ActionButton> </ActionButton>
{/if} {/if}
{#if isBuilder}
<ActionButton <ActionButton
quiet quiet
icon="Edit" icon="Edit"
@ -40,6 +43,7 @@
> >
Edit Edit
</ActionButton> </ActionButton>
{/if}
<ActionButton <ActionButton
quiet quiet
icon="LinkOut" icon="LinkOut"