From 7d26597a5439c3ccd759df52be00aa2fd7b8eda7 Mon Sep 17 00:00:00 2001 From: Guilhem Lemouel Date: Fri, 30 Oct 2026 07:58:21 -0700 Subject: [PATCH] fixup! feat: create a service account from the run-as picker at deploy Co-Authored-By: Claude Opus 5.5 --- .../lib/components/access/ItemReads.svelte | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/frontend/src/lib/components/access/ItemReads.svelte b/frontend/src/lib/components/access/ItemReads.svelte index afe0f3004d..9d98278781 100644 --- a/frontend/src/lib/components/access/ItemReads.svelte +++ b/frontend/src/lib/components/access/ItemReads.svelte @@ -31,7 +31,12 @@ account: string | undefined } = $props() - type Report = { key: string; needs: Needs; reads?: Set | 'all' } + type Report = { + key: string + needs: Needs + reads?: Set | 'all' + accessError?: string + } const operatingUser = useOperatingUser() const me = $derived( @@ -60,19 +65,24 @@ const forKey = key if (!forKey) return const principal = mode === 'checked' ? account : undefined + // A saved run-as user that is disabled or deleted fails the access check; the list still + // matters most then, so only the scan failing hides the section. + const access = principal + ? GranularAclService.getPrincipalAccess({ workspace, principal }).then( + (a) => ({ + reads: a.is_admin + ? ('all' as const) + : new Set(a.items.map((i) => `${i.kind}:${i.path}`)) + }), + (e: any) => ({ accessError: `${e?.body ?? e}` }) + ) + : Promise.resolve({}) try { - const [needs, access] = await Promise.all([ + const [needs, result] = await Promise.all([ detectNeeds(workspace, kind, itemPath ?? '', needsSource?.()), - principal - ? GranularAclService.getPrincipalAccess({ workspace, principal }) - : Promise.resolve(undefined) + access ]) - const reads = access - ? access.is_admin - ? ('all' as const) - : new Set(access.items.map((i) => `${i.kind}:${i.path}`)) - : undefined - if (id === requestId) report = { key: forKey, needs, reads } + if (id === requestId) report = { key: forKey, needs, ...result } } catch { if (id === requestId) report = undefined } @@ -190,6 +200,9 @@ {/if} + {#if shown?.accessError} + Couldn't check {account}'s access: {shown.accessError} + {/if} {#if mode === 'caller'} It runs as whoever runs it, so each of them needs read access to these.