mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-12-03 16:10:37 +00:00
fix: disable scripts and flows as tools on a role that cannot run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1405657a21
commit
473ddb6aed
@@ -46,20 +46,22 @@
|
||||
const effective = $derived(setting ?? instanceLimit)
|
||||
const limited = $derived(effective != undefined && effective.access !== 'follow_role')
|
||||
|
||||
// Not below what the role can already do. One that is stored stays selectable, with a hint.
|
||||
const runRedundant = $derived(canRun === false && setting?.access !== 'read_run')
|
||||
// Both run, so a role that cannot run gets nothing from them. One that is stored stays
|
||||
// selectable, with a hint.
|
||||
const RUNS = ['read_run', 'runnables']
|
||||
const runRedundant = (value: string) =>
|
||||
canRun === false && RUNS.includes(value) && setting?.access !== value
|
||||
|
||||
const items = $derived([
|
||||
...(instanceLimit ? [{ value: INHERIT, label: inheritedLabel(instanceLimit) }] : []),
|
||||
...Object.entries(MCP_ROLE_LIMIT_LABELS)
|
||||
.filter(
|
||||
([value]) =>
|
||||
value === setting?.access || (!frozen && (workspace || value !== 'runnables'))
|
||||
([value]) => value === setting?.access || (!frozen && (workspace || value !== 'runnables'))
|
||||
)
|
||||
.map(([value, label]) => ({
|
||||
value,
|
||||
label,
|
||||
...(value === 'read_run' && runRedundant
|
||||
...(runRedundant(value)
|
||||
? { disabled: true, subtitle: 'This role cannot run scripts and flows' }
|
||||
: {})
|
||||
}))
|
||||
@@ -142,10 +144,14 @@
|
||||
bind:value={() => setting?.access ?? INHERIT, (v) => v && setAccess(v)}
|
||||
/>
|
||||
</div>
|
||||
{#if effective?.access === 'read_run' && canRun === false}
|
||||
{#if canRun === false && effective?.access === 'read_run'}
|
||||
<span class="text-2xs text-secondary">
|
||||
This role cannot run scripts and flows, so its members get read only.
|
||||
</span>
|
||||
{:else if canRun === false && effective?.access === 'runnables'}
|
||||
<span class="text-2xs text-secondary">
|
||||
This role cannot run scripts and flows, so its members get no tools.
|
||||
</span>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if setting?.access === 'runnables'}
|
||||
|
||||
Reference in New Issue
Block a user