fix: keep read only for a role that cannot run, which still holds its admins

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-12-03 17:21:07 +01:00
co-authored by Claude Opus 5.5
parent 6e16b0a01d
commit 7cd4bb2729
@@ -52,9 +52,12 @@
const selected = $derived(setting?.access ?? (instanceLimit ? INHERIT : ROLE))
// Only what lowers the access: a role that cannot run already reads only, and gets nothing
// from running tools. A stored entry stays listed.
// from running tools. Read only stays, since workspace admins holding the role still run. A
// stored entry stays listed.
const lowers = (value: Access) =>
value === 'off' || (canRun !== false && (workspace !== undefined || value !== 'runnables'))
value === 'off' ||
value === 'read_only' ||
(canRun !== false && (workspace !== undefined || value !== 'runnables'))
const items = $derived(
[
@@ -87,7 +90,7 @@
if (canRun === false) {
return effective === 'runnables'
? 'No tools: this role cannot run scripts and flows.'
: 'Explore and read. Nothing is run.'
: 'Explore and read. Nothing is run, except by workspace admins holding this role.'
}
if (effective === 'runnables') return 'These scripts and flows, each as its own tool.'
if (effective === 'read_only') return 'Explore and read. Nothing is run.'