From d9c3d4d661b7cfc21f1c09834f3d67af8cc3a02e Mon Sep 17 00:00:00 2001 From: MechaCat02 Date: Thu, 28 May 2026 19:31:56 +0200 Subject: [PATCH] feat(dashboard): shadow apps + app-detail surfaces by role Apps list: hide "New app" for members. App detail: hide New script for viewers, Add domain + per-row Delete for non-admins, and the Members + Settings tabs entirely for non-admins (with an effect that bounces a stale activeTab back to Scripts). Co-Authored-By: Claude Opus 4.7 (1M context) --- dashboard/src/routes/apps/+page.svelte | 27 ++++-- dashboard/src/routes/apps/[slug]/+page.svelte | 94 ++++++++++++------- 2 files changed, 75 insertions(+), 46 deletions(-) diff --git a/dashboard/src/routes/apps/+page.svelte b/dashboard/src/routes/apps/+page.svelte index cbfd75a..96b4dfe 100644 --- a/dashboard/src/routes/apps/+page.svelte +++ b/dashboard/src/routes/apps/+page.svelte @@ -2,6 +2,11 @@ import { base } from '$app/paths'; import { api, ApiError, type App } from '$lib/api'; import { slugify, SLUG_MAX } from '$lib/slugify'; + import { canCreateApp } from '$lib/capabilities'; + import { currentUser } from '$lib/auth'; + + const me = $derived($currentUser); + const canCreate = $derived(canCreateApp(me)); let apps = $state(null); let listError = $state(null); @@ -99,18 +104,20 @@
- {#if showCreate} + {#if showCreate && canCreate}
submitCreate(e)}>
{/if}
- {:else if activeTab === 'settings'} + {:else if activeTab === 'settings' && canAdmin}

Settings

saveSettings(e)}>