Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

feat(gfs): redesign share access flow

M826cbdde3fe7
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 82a67ff76..c1ab5a31a 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -13062,6 +13062,7 @@ button.cu-gfs-tree__button:focus-visible,
.cu-gfs-manage-dialog__title-row h3 {
min-width: 0;
+ white-space: normal;
}
.cu-gfs-inline-rename {
@@ -13460,6 +13461,17 @@ button.cu-gfs-tree__button:focus-visible,
gap: var(--cu-space-2);
}
+.cu-gfs-grant__composer:not(.cu-gfs-grant__composer--details) {
+ grid-template-columns: minmax(0, 1fr);
+}
+
+.cu-gfs-role-select.cu-input {
+ min-width: 8.5rem;
+ min-height: 2.875rem;
+ background-color: var(--cu-bg-elevated);
+ font-weight: 500;
+}
+
.cu-gfs-subject-picker,
.cu-gfs-permission-dropdown {
position: relative;
@@ -13778,9 +13790,9 @@ button.cu-gfs-tree__button:focus-visible,
gap: var(--cu-space-2);
min-width: 0;
padding: var(--cu-space-2);
- border: 1px solid var(--cu-border);
+ border: 0;
border-radius: var(--cu-radius-sm);
- background: var(--cu-surface);
+ background: transparent;
}
.cu-gfs-existing-access__identity {
@@ -13815,6 +13827,28 @@ button.cu-gfs-tree__button:focus-visible,
gap: var(--cu-space-1);
}
+.cu-gfs-existing-access__role.cu-input {
+ width: 7rem;
+ min-height: 2rem;
+ border-color: transparent;
+ background-color: transparent;
+ font-weight: 500;
+}
+
+.cu-gfs-existing-access__role.cu-input:hover,
+.cu-gfs-existing-access__role.cu-input:focus {
+ border-color: var(--cu-border);
+ background-color: var(--cu-bg-elevated);
+}
+
+.cu-gfs-existing-access__role-label {
+ min-width: 7rem;
+ padding-inline: var(--cu-space-2);
+ color: var(--cu-text-soft);
+ font-size: 0.8125rem;
+ font-weight: 500;
+}
+
.cu-gfs-existing-access__chips {
display: inline-flex;
flex-wrap: wrap;
diff --git a/control-ui/components/GfsBrowser.tsx b/control-ui/components/GfsBrowser.tsx
index 5b0381784..d82509554 100644
--- a/control-ui/components/GfsBrowser.tsx
+++ b/control-ui/components/GfsBrowser.tsx
@@ -1413,7 +1413,7 @@ export function GfsBrowser(): React.JSX.Element {
className="cu-gfs-manage-dialog"
role="dialog"
aria-modal="true"
- aria-label={`Manage ${selected.kind === 'directory' ? 'folder' : 'file'} ${selected.name}`}
+ aria-label={`Share ${selected.kind === 'directory' ? 'folder' : 'file'} ${selected.name}`}
>
<header className="cu-gfs-manage-dialog__header">
<span
@@ -1445,7 +1445,7 @@ export function GfsBrowser(): React.JSX.Element {
/>
) : (
<span className="cu-gfs-manage-dialog__title-row">
- <h3>{selected.name}</h3>
+ <h3>Share “{selected.name}”</h3>
<GfsResourceMenu
resourceName={selected.name}
resourceUri={selected.gfsUri}
@@ -1486,7 +1486,7 @@ export function GfsBrowser(): React.JSX.Element {
autoFocus
className="cu-gfs-manage-dialog__close"
variant="ghost"
- aria-label="Close manage dialog"
+ aria-label="Close share dialog"
onClick={() => setSelected(null)}
>
<IconX width={18} height={18} />
@@ -1497,8 +1497,7 @@ export function GfsBrowser(): React.JSX.Element {
<div className="cu-gfs-manage-dialog__body">
<section className="cu-gfs-manage-section cu-gfs-manage-section--access">
<div className="cu-gfs-manage-section__header">
- <h4>Access</h4>
- <p>Control who can use this resource and what they can do.</p>
+ <h4>Add people, teams, agents, or workflows</h4>
</div>
<GfsGrantPanel
resource={{
diff --git a/control-ui/components/GfsGrantPanel.tsx b/control-ui/components/GfsGrantPanel.tsx
index a35cbb029..326dd1887 100644
--- a/control-ui/components/GfsGrantPanel.tsx
+++ b/control-ui/components/GfsGrantPanel.tsx
@@ -2,13 +2,11 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useConfirmDialog } from '@components/ConfirmDialog'
-import { GfsPermissionDropdown } from '@components/GfsPermissionDropdown'
-import { GFS_PERMISSION_LABELS } from '@components/GfsPermissionDropdown/constants'
import { GfsSubjectPicker } from '@components/GfsSubjectPicker'
import type { SelectionDropdownOption } from '@components/SelectionDropdown/types'
import { IconFolder } from '@components/Sidebar/icons'
import { useToast } from '@components/Toast'
-import { Button, CheckboxField } from '@components/ui'
+import { Button, CheckboxField, SelectInput } from '@components/ui'
import { GFS_MAX_BULK_SUBJECTS } from '@constants/gfsGrantSubjects'
import {
type AdminUser,
@@ -39,10 +37,24 @@ import { buildGfsBulkSubjectOptions, toGfsBulkSubjectInputs } from './gfsGrantSu
* authoritative.
*/
-const PERMISSION_BITS = ['read', 'write', 'delete', 'manage_acl', 'share'] as const
-const HOST_PERMISSION_BITS = ['read', 'write'] as const
const OPERATOR_VALUE = 'operator'
const DRIVE = 'main'
+type AccessRole = 'read' | 'editor'
+
+function rolePermissions(role: AccessRole, hostOnly: boolean): string[] {
+ if (hostOnly) return role === 'editor' ? ['read', 'write'] : ['read']
+ return role === 'editor' ? ['read', 'write', 'delete', 'manage_acl', 'share'] : ['read', 'share']
+}
+
+function roleForPermissions(permissions: string[]): AccessRole {
+ return permissions.some(permission => ['write', 'delete', 'manage_acl'].includes(permission))
+ ? 'editor'
+ : 'read'
+}
+
+function hostOnlySubject(subject: { type: string }): boolean {
+ return subject.type === 'host'
+}
const OPERATOR_OPTION: SelectionDropdownOption = {
value: OPERATOR_VALUE,
@@ -51,9 +63,7 @@ const OPERATOR_OPTION: SelectionDropdownOption = {
badge: 'Operator',
}
-export function GfsGrantPanel({
- resource,
-}: GfsGrantPanelProps): React.JSX.Element {
+export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Element {
const { showToast } = useToast()
const { confirm, confirmDialog } = useConfirmDialog()
const [users, setUsers] = useState<AdminUser[]>([])
@@ -64,10 +74,9 @@ export function GfsGrantPanel({
const [directoryError, setDirectoryError] = useState('')
const [selectedValues, setSelectedValues] = useState<string[]>([])
const [selectionError, setSelectionError] = useState('')
- const [bits, setBits] = useState<string[]>([])
+ const [role, setRole] = useState<AccessRole>('read')
const [includeDescendants, setIncludeDescendants] = useState(resource.kind === 'directory')
const [busy, setBusy] = useState(false)
- const [confirming, setConfirming] = useState(false)
const [error, setError] = useState('')
const [existingAccess, setExistingAccess] = useState<GfsExistingAccessItem[]>([])
const [existingAccessLoading, setExistingAccessLoading] = useState(true)
@@ -182,9 +191,9 @@ export function GfsGrantPanel({
[selectedBulkOptions]
)
const hasHost = selectedSubjects.some(subject => subject.type === 'host')
- const visiblePermissionBits = hasHost ? HOST_PERMISSION_BITS : PERMISSION_BITS
const subjectValid = operatorSelected || selectedSubjects.length > 0
- const actionPending = busy || confirming
+ const actionPending = busy
+ const bits = rolePermissions(role, hasHost)
const canSubmit = subjectValid && bits.length > 0 && !actionPending
function changeSelectedSubjects(nextValues: string[]) {
@@ -204,11 +213,6 @@ export function GfsGrantPanel({
const nextOptions = bulkValues
.map(value => bulkSubjectOptions.find(option => option.value === value))
.filter(option => option !== undefined)
- if (nextOptions.some(option => option.subject.type === 'host')) {
- setBits(current =>
- current.filter(bit => HOST_PERMISSION_BITS.includes(bit as 'read' | 'write'))
- )
- }
setSelectionError('')
setSelectedValues(bulkValues)
}
@@ -220,32 +224,6 @@ export function GfsGrantPanel({
return
}
- const recipientSummary = operatorSelected
- ? 'the cluster operator'
- : (() => {
- const counts = selectedSubjects.reduce<Record<string, number>>((result, subject) => {
- result[subject.type] = (result[subject.type] ?? 0) + 1
- return result
- }, {})
- const types = Object.entries(counts)
- .map(([type, count]) => `${count} ${type}${count === 1 ? '' : 's'}`)
- .join(', ')
- return `${selectedSubjects.length} recipient${selectedSubjects.length === 1 ? '' : 's'} (${types})`
- })()
- const scope =
- canIncludeDescendants && includeDescendants
- ? 'this resource and all descendants'
- : 'this resource only'
-
- setConfirming(true)
- const confirmed = await confirm({
- title: 'Grant access?',
- message: `Grant access for ${recipientSummary} on "${resource.name}". Permissions: ${bits.join(', ')}. Scope: ${scope}.`,
- confirmLabel: 'Grant access',
- })
- setConfirming(false)
- if (!confirmed) return
-
setBusy(true)
try {
if (operatorSelected) {
@@ -265,10 +243,10 @@ export function GfsGrantPanel({
}
await putGfsGrant({ ...body, inherit: includeDescendants })
}
- showToast('Grant saved.', { tone: 'success' })
+ showToast('Access shared.', { tone: 'success' })
await loadExistingAccess()
- setBits([])
setSelectedValues([])
+ setRole('read')
setSelectionError('')
setIncludeDescendants(resource.kind === 'directory')
} catch (e) {
@@ -337,9 +315,38 @@ export function GfsGrantPanel({
}
}
+ async function updateAccessRole(item: GfsExistingAccessItem, nextRole: AccessRole) {
+ if (item.kind !== 'grant') return
+ const permissions = rolePermissions(nextRole, hostOnlySubject(item.subject))
+ setBusy(true)
+ setError('')
+ try {
+ await putGfsGrant({
+ drive: DRIVE,
+ resourceId: resource.resourceId,
+ subject: item.subject,
+ permissions,
+ inherit: item.inherit,
+ })
+ showToast(
+ `${subjectLabel(item)} is now ${nextRole === 'editor' ? 'an Editor' : 'Read-only'}.`,
+ {
+ tone: 'success',
+ }
+ )
+ await loadExistingAccess()
+ } catch (caught) {
+ setError(caught instanceof Error ? caught.message : 'Failed to update access')
+ } finally {
+ setBusy(false)
+ }
+ }
+
return (
<div className="cu-gfs-grant-panel">
- <div className="cu-gfs-grant__composer">
+ <div
+ className={`cu-gfs-grant__composer${subjectValid ? ' cu-gfs-grant__composer--details' : ''}`}
+ >
<GfsSubjectPicker
disabled={actionPending}
loading={directoryLoading}
@@ -347,12 +354,18 @@ export function GfsGrantPanel({
options={subjectOptions}
value={selectedValues}
/>
- <GfsPermissionDropdown
- disabled={actionPending}
- onChange={setBits}
- permissions={visiblePermissionBits}
- value={bits}
- />
+ {subjectValid ? (
+ <SelectInput
+ aria-label="Access role for selected recipients"
+ className="cu-gfs-role-select"
+ disabled={actionPending}
+ onChange={event => setRole(event.currentTarget.value as AccessRole)}
+ value={role}
+ >
+ <option value="read">Read</option>
+ <option value="editor">Editor</option>
+ </SelectInput>
+ ) : null}
</div>
{selectionError ? (
<p role="alert" className="cu-field__error">
@@ -364,105 +377,128 @@ export function GfsGrantPanel({
{directoryError}
</p>
) : null}
- {hasHost ? (
- <p className="cu-field__hint">
- Host selections are limited to read and write in Control UI. Incompatible permissions were
- removed.
- </p>
+ {subjectValid && hasHost ? (
+ <p className="cu-field__hint">Agents, workflows, and plugins use read/write access only.</p>
) : null}
- <div className="cu-gfs-grant__scope-actions">
- {canIncludeDescendants ? (
- <CheckboxField
- className="cu-gfs-grant__scope"
- label="Include contents of this folder"
- checked={includeDescendants}
- onChange={() => setIncludeDescendants(current => !current)}
- disabled={actionPending}
- />
- ) : null}
- <div className="cu-gfs-grant__actions">
- <Button variant="primary" disabled={!canSubmit} onClick={() => submit()}>
- Grant access
- </Button>
+ {subjectValid ? (
+ <div className="cu-gfs-grant__scope-actions">
+ {canIncludeDescendants ? (
+ <CheckboxField
+ className="cu-gfs-grant__scope"
+ label="Include contents of this folder"
+ checked={includeDescendants}
+ onChange={() => setIncludeDescendants(current => !current)}
+ disabled={actionPending}
+ />
+ ) : null}
+ <div className="cu-gfs-grant__actions">
+ <Button
+ disabled={actionPending}
+ onClick={() => {
+ setSelectedValues([])
+ setRole('read')
+ setSelectionError('')
+ }}
+ variant="ghost"
+ >
+ Back
+ </Button>
+ <Button variant="primary" disabled={!canSubmit} onClick={() => submit()}>
+ Share
+ </Button>
+ </div>
</div>
- </div>
+ ) : null}
{error ? (
<p role="alert" className="cu-field__error">
{error}
</p>
) : null}
- <section className="cu-gfs-existing-access" aria-label="Who has access">
- <div className="cu-gfs-existing-access__header">
- <h4>Who has access</h4>
- <p>Existing grants and shares on this resource. Revoking is immediate.</p>
- </div>
- {existingAccessLoading ? (
- <p className="cu-gfs-existing-access__empty" role="status">
- Loading access…
- </p>
- ) : existingAccessError ? (
- <div className="cu-gfs-existing-access__error">
- <p role="alert" className="cu-field__error">
- {existingAccessError}
- </p>
- <Button size="sm" disabled={actionPending} onClick={() => void loadExistingAccess()}>
- Retry
- </Button>
+ {!subjectValid ? (
+ <section className="cu-gfs-existing-access" aria-label="People with access">
+ <div className="cu-gfs-existing-access__header">
+ <h4>People with access</h4>
</div>
- ) : existingAccess.length === 0 ? (
- <p className="cu-gfs-existing-access__empty">No direct grants or shares yet.</p>
- ) : (
- <ul className="cu-gfs-existing-access__list" aria-label="Resource access">
- {existingAccess.map(item => {
- const label = subjectLabel(item)
- const coversDescendants =
- item.kind === 'grant' ? item.inherit : item.includeDescendants
- return (
- <li
- className="cu-gfs-existing-access__item"
- data-testid={`gfs-access-row-${item.kind}-${item.id}`}
- key={`${item.kind}:${item.id}`}
- >
- <span className="cu-gfs-existing-access__identity">
- <span className="cu-gfs-existing-access__subject">{label}</span>
- <span className="cu-gfs-existing-access__detail">
- {item.kind === 'grant' ? 'Direct grant' : 'Direct share'} ·{' '}
- {item.subject.type}
+ {existingAccessLoading ? (
+ <p className="cu-gfs-existing-access__empty" role="status">
+ Loading access…
+ </p>
+ ) : existingAccessError ? (
+ <div className="cu-gfs-existing-access__error">
+ <p role="alert" className="cu-field__error">
+ {existingAccessError}
+ </p>
+ <Button size="sm" disabled={actionPending} onClick={() => void loadExistingAccess()}>
+ Retry
+ </Button>
+ </div>
+ ) : existingAccess.length === 0 ? (
+ <p className="cu-gfs-existing-access__empty">No direct grants or shares yet.</p>
+ ) : (
+ <ul className="cu-gfs-existing-access__list" aria-label="Resource access">
+ {existingAccess.map(item => {
+ const label = subjectLabel(item)
+ const coversDescendants =
+ item.kind === 'grant' ? item.inherit : item.includeDescendants
+ return (
+ <li
+ className="cu-gfs-existing-access__item"
+ data-testid={`gfs-access-row-${item.kind}-${item.id}`}
+ key={`${item.kind}:${item.id}`}
+ >
+ <span className="cu-gfs-existing-access__identity">
+ <span className="cu-gfs-existing-access__subject">{label}</span>
+ <span className="cu-gfs-existing-access__detail">
+ {item.kind === 'grant' ? 'Direct grant' : 'Direct share'} ·{' '}
+ {item.subject.type}
+ </span>
</span>
- </span>
- <span className="cu-gfs-existing-access__meta">
- <span className="cu-gfs-existing-access__chips" aria-label="Permissions">
- {item.permissions.map(permission => (
- <span className="cu-gfs-existing-access__permission" key={permission}>
- {GFS_PERMISSION_LABELS[permission] ?? permission}
+ <span className="cu-gfs-existing-access__meta">
+ {item.kind === 'grant' ? (
+ <SelectInput
+ aria-label={`Access role for ${label}`}
+ className="cu-gfs-existing-access__role"
+ compact
+ disabled={actionPending}
+ onChange={event =>
+ void updateAccessRole(item, event.currentTarget.value as AccessRole)
+ }
+ value={roleForPermissions(item.permissions)}
+ >
+ <option value="read">Read</option>
+ <option value="editor">Editor</option>
+ </SelectInput>
+ ) : (
+ <span className="cu-gfs-existing-access__role-label">
+ {roleForPermissions(item.permissions) === 'editor' ? 'Editor' : 'Read'}
+ </span>
+ )}
+ {coversDescendants ? (
+ <span className="cu-gfs-existing-access__inherit">
+ <IconFolder />
+ Includes contents
</span>
- ))}
+ ) : null}
</span>
- {coversDescendants ? (
- <span className="cu-gfs-existing-access__inherit">
- <IconFolder />
- Includes contents
- </span>
- ) : null}
- </span>
- <Button
- aria-label={`Remove ${item.kind} access for ${label}`}
- className="cu-gfs-existing-access__revoke"
- data-testid={`gfs-revoke-${item.kind}-${item.id}`}
- title={`Remove ${item.kind} access for ${label}`}
- size="sm"
- disabled={actionPending}
- onClick={() => void revokeAccess(item)}
- variant="ghost"
- >
- X
- </Button>
- </li>
- )
- })}
- </ul>
- )}
- </section>
+ <Button
+ aria-label={`Remove ${item.kind} access for ${label}`}
+ className="cu-gfs-existing-access__revoke"
+ data-testid={`gfs-revoke-${item.kind}-${item.id}`}
+ title={`Remove ${item.kind} access for ${label}`}
+ size="sm"
+ disabled={actionPending}
+ onClick={() => void revokeAccess(item)}
+ variant="ghost"
+ >
+ X
+ </Button>
+ </li>
+ )
+ })}
+ </ul>
+ )}
+ </section>
+ ) : null}
{confirmDialog}
</div>
)
diff --git a/control-ui/components/__tests__/GfsBrowser.test.tsx b/control-ui/components/__tests__/GfsBrowser.test.tsx
index 342701fa9..355a93884 100644
--- a/control-ui/components/__tests__/GfsBrowser.test.tsx
+++ b/control-ui/components/__tests__/GfsBrowser.test.tsx
@@ -94,14 +94,9 @@ async function openSubjectPicker() {
}
function selectPermission(label: string) {
- fireEvent.click(screen.getByRole('button', { name: 'Permissions' }))
- fireEvent.click(screen.getByRole('menuitemcheckbox', { name: label }))
-}
-
-async function confirmGrantAccess() {
- const dialog = await screen.findByRole('alertdialog', { name: 'Grant access?' })
- fireEvent.click(within(dialog).getByRole('button', { name: 'Grant access' }))
- await waitFor(() => expect(screen.queryByRole('alertdialog')).toBeNull())
+ fireEvent.change(screen.getByRole('combobox', { name: 'Access role for selected recipients' }), {
+ target: { value: label === 'Read' ? 'read' : 'editor' },
+ })
}
async function openResourceMenu(resourceName: string) {
@@ -925,7 +920,7 @@ describe('GfsBrowser', () => {
renderBrowser()
await openManage('report.txt')
- const manageDialog = await screen.findByRole('dialog', { name: 'Manage file report.txt' })
+ const manageDialog = await screen.findByRole('dialog', { name: 'Share file report.txt' })
const manageMenuTrigger = within(manageDialog).getByRole('button', {
name: 'Actions for report.txt',
})
@@ -1474,7 +1469,7 @@ describe('GfsBrowser', () => {
await openManage('report.md')
await waitFor(() => expect(mockGetAdminUsers).toHaveBeenCalledWith(''))
await waitFor(() => expect(mockGetAdminTeams).toHaveBeenCalled())
- const manageDialog = screen.getByRole('dialog', { name: 'Manage file report.md' })
+ const manageDialog = screen.getByRole('dialog', { name: 'Share file report.md' })
const manageMenuTrigger = within(manageDialog).getByRole('button', {
name: 'Actions for report.md',
})
@@ -1492,15 +1487,14 @@ describe('GfsBrowser', () => {
await openSubjectPicker()
fireEvent.click(await screen.findByRole('option', { name: 'Ada Lovelace' }))
selectPermission('Read')
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
- await confirmGrantAccess()
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
await waitFor(() =>
expect(mockPutGfsGrant).toHaveBeenCalledWith({
drive: 'main',
resourceId: 'id-2',
subjects: [{ type: 'user', id: '11111111-1111-1111-1111-111111111111' }],
- permissions: ['read'],
+ permissions: ['read', 'share'],
inherit: false,
})
)
@@ -1518,7 +1512,7 @@ describe('GfsBrowser', () => {
fireEvent.click(await screen.findByRole('option', { name: 'Ada Lovelace' }))
selectPermission('Read')
- expect(screen.getByRole('button', { name: 'Grant access' })).not.toBeDisabled()
+ expect(screen.getByRole('button', { name: 'Share' })).not.toBeDisabled()
})
it('does not expose share creation from a directory resource menu', async () => {
@@ -1540,10 +1534,8 @@ describe('GfsBrowser', () => {
)
expect(screen.queryByText('Manage folder')).toBeNull()
await waitFor(() => expect(mockGetAdminUsers).toHaveBeenCalledWith(''))
- expect(
- await screen.findByRole('checkbox', { name: /Include contents of this folder/ })
- ).toBeChecked()
- const manageDialog = screen.getByRole('dialog', { name: 'Manage folder team-folder' })
+ expect(screen.queryByRole('checkbox', { name: /Include contents of this folder/ })).toBeNull()
+ const manageDialog = screen.getByRole('dialog', { name: 'Share folder team-folder' })
const manageMenuTrigger = within(manageDialog).getByRole('button', {
name: 'Actions for team-folder',
})
@@ -1554,7 +1546,8 @@ describe('GfsBrowser', () => {
await openSubjectPicker()
fireEvent.click(await screen.findByRole('option', { name: 'Ada Lovelace' }))
selectPermission('Read')
- expect(screen.getByRole('button', { name: 'Grant access' })).toBeEnabled()
+ expect(screen.getByRole('checkbox', { name: /Include contents of this folder/ })).toBeChecked()
+ expect(screen.getByRole('button', { name: 'Share' })).toBeEnabled()
})
it('lets an operator select team and operator subjects without typing UUIDs', async () => {
@@ -1571,8 +1564,7 @@ describe('GfsBrowser', () => {
expect(within(screen.getByRole('listbox')).getByRole('option', { name: 'Ada Lovelace' }))
fireEvent.click(await screen.findByRole('option', { name: 'Research' }))
selectPermission('Read')
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
- await confirmGrantAccess()
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
await waitFor(() =>
expect(mockPutGfsGrant).toHaveBeenCalledWith(
@@ -1585,8 +1577,7 @@ describe('GfsBrowser', () => {
await openSubjectPicker()
fireEvent.click(await screen.findByRole('option', { name: 'Operator' }))
selectPermission('Read')
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
- await confirmGrantAccess()
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
await waitFor(() =>
expect(mockPutGfsGrant).toHaveBeenLastCalledWith(
@@ -1610,8 +1601,7 @@ describe('GfsBrowser', () => {
await openSubjectPicker()
fireEvent.click(await screen.findByRole('option', { name: 'Ada Lovelace' }))
selectPermission('Write')
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
- await confirmGrantAccess()
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
expect((await screen.findByText('escalation_rejected')).getAttribute('role')).toBe('alert')
})
diff --git a/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx b/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
index 16e8e76db..9af4170bd 100644
--- a/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
+++ b/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
@@ -81,27 +81,14 @@ async function chooseSubjects(...names: string[]) {
for (const name of names) fireEvent.click(screen.getByRole('option', { name }))
}
-function openPermissionMenu() {
- let menu = screen.queryByRole('menu', { name: 'Permissions' })
- if (!menu) {
- const trigger = document.querySelector<HTMLButtonElement>(
- '.cu-gfs-permission-dropdown__trigger'
- )
- if (!trigger) throw new Error('permission trigger missing')
- fireEvent.click(trigger)
- menu = screen.getByRole('menu', { name: 'Permissions' })
- }
- return menu
-}
-
function selectPermission(name: string) {
- fireEvent.click(within(openPermissionMenu()).getByRole('menuitemcheckbox', { name }))
+ fireEvent.change(screen.getByRole('combobox', { name: 'Access role for selected recipients' }), {
+ target: { value: name === 'Read' ? 'read' : 'editor' },
+ })
}
-async function submit(action: 'Grant access') {
+async function submit(action: 'Share') {
fireEvent.click(screen.getByRole('button', { name: action }))
- const dialog = await screen.findByRole('alertdialog')
- fireEvent.click(within(dialog).getByRole('button', { name: action }))
}
describe('GfsGrantPanel bulk access', () => {
@@ -157,11 +144,12 @@ describe('GfsGrantPanel bulk access', () => {
.mockResolvedValueOnce({ items: [] })
renderPanel()
- const existing = await screen.findByRole('region', { name: 'Who has access' })
+ const existing = await screen.findByRole('region', { name: 'People with access' })
expect(within(existing).getByText('Ada Lovelace')).toBeTruthy()
expect(within(existing).getByText('Direct grant · user')).toBeTruthy()
- expect(within(existing).getByText('Read')).toBeTruthy()
- expect(within(existing).getByText('Write')).toBeTruthy()
+ expect(
+ within(existing).getByRole('combobox', { name: 'Access role for Ada Lovelace' })
+ ).toHaveValue('editor')
expect(within(existing).getByText('X')).toBeTruthy()
expect(
within(existing).getByRole('button', { name: 'Remove grant access for Ada Lovelace' })
@@ -184,6 +172,45 @@ describe('GfsGrantPanel bulk access', () => {
expect(mockGetGfsShares).toHaveBeenCalledTimes(2)
})
+ it('changes an existing member between Editor and Read', async () => {
+ const persistedGrant = {
+ id: '33333333-3333-3333-3333-333333333333',
+ drive: 'main',
+ resourceId: resource.resourceId,
+ subject: userSubject,
+ permissions: ['read', 'write', 'delete', 'manage_acl', 'share'],
+ inherit: false,
+ }
+ mockGetGfsGrants
+ .mockResolvedValueOnce({ items: [persistedGrant] })
+ .mockResolvedValueOnce({ items: [{ ...persistedGrant, permissions: ['read', 'share'] }] })
+ mockPutGfsGrant.mockResolvedValue(successfulMutation(userSubject))
+ renderPanel()
+
+ const role = await screen.findByRole('combobox', { name: 'Access role for Ada Lovelace' })
+ expect((role as HTMLSelectElement).value).toBe('editor')
+ fireEvent.change(role, { target: { value: 'read' } })
+
+ await waitFor(() =>
+ expect(mockPutGfsGrant).toHaveBeenCalledWith({
+ drive: 'main',
+ resourceId: resource.resourceId,
+ subject: userSubject,
+ permissions: ['read', 'share'],
+ inherit: false,
+ })
+ )
+ await waitFor(() =>
+ expect(
+ (
+ screen.getByRole('combobox', {
+ name: 'Access role for Ada Lovelace',
+ }) as HTMLSelectElement
+ ).value
+ ).toBe('read')
+ )
+ })
+
it('self-heals a row that another admin already revoked without hiding other errors', async () => {
mockGetGfsGrants
.mockResolvedValueOnce({
@@ -206,7 +233,7 @@ describe('GfsGrantPanel bulk access', () => {
})
)
renderPanel()
- const existing = await screen.findByRole('region', { name: 'Who has access' })
+ const existing = await screen.findByRole('region', { name: 'People with access' })
fireEvent.click(
within(existing).getByRole('button', { name: 'Remove grant access for Ada Lovelace' })
)
@@ -241,7 +268,7 @@ describe('GfsGrantPanel bulk access', () => {
})
)
renderPanel()
- const existing = await screen.findByRole('region', { name: 'Who has access' })
+ const existing = await screen.findByRole('region', { name: 'People with access' })
fireEvent.click(
within(existing).getByRole('button', { name: 'Remove grant access for Ada Lovelace' })
)
@@ -277,9 +304,9 @@ describe('GfsGrantPanel bulk access', () => {
const initialSignal = mockGetGfsGrants.mock.calls[0][2]
await chooseSubjects('Ada Lovelace')
selectPermission('Read')
- await submit('Grant access')
+ await submit('Share')
- const existing = await screen.findByRole('region', { name: 'Who has access' })
+ const existing = await screen.findByRole('region', { name: 'People with access' })
expect(await within(existing).findByText('Direct grant · user')).toBeTruthy()
expect(initialSignal?.aborted).toBe(true)
resolveInitialGrants({ items: [] })
@@ -327,16 +354,14 @@ describe('GfsGrantPanel bulk access', () => {
)
renderPanel()
await chooseSubjects('Ada Lovelace', 'Research')
- selectPermission('Read')
- selectPermission('Delete')
+ selectPermission('Editor')
await chooseSubjects('chatllm (Stateful)', 'chatllm-stateless (Stateless)', 'sandbox-ui-hello')
- const permissions = openPermissionMenu()
- expect(within(permissions).getByRole('menuitemcheckbox', { name: 'Read' })).toBeChecked()
- expect(within(permissions).getByRole('menuitemcheckbox', { name: 'Write' })).not.toBeChecked()
- expect(within(permissions).queryByRole('menuitemcheckbox', { name: 'Delete' })).toBeNull()
- expect(within(permissions).queryByRole('menuitemcheckbox', { name: 'Share' })).toBeNull()
- await submit('Grant access')
+ expect(screen.getByText(/use read\/write access only/i)).toBeTruthy()
+ expect(
+ screen.getByRole('combobox', { name: 'Access role for selected recipients' })
+ ).toHaveValue('editor')
+ await submit('Share')
await waitFor(() =>
expect(mockPutGfsGrant).toHaveBeenCalledWith({
@@ -349,29 +374,24 @@ describe('GfsGrantPanel bulk access', () => {
{ type: 'host', id: '1st:mcp-host/chatllm-stateless' },
{ type: 'host', id: '3rd:sandbox-recipes/sandbox-ui-hello' },
],
- permissions: ['read'],
+ permissions: ['read', 'write'],
inherit: false,
})
)
await waitFor(() => expect(mockGetGfsGrants).toHaveBeenCalledTimes(2))
})
- it('requires an explicit scope review before creating access', async () => {
+ it('shows scope and role only after a recipient is selected', async () => {
const directory = { ...resource, name: 'reports', kind: 'directory' as const }
renderPanel(directory)
+ expect(screen.queryByRole('button', { name: 'Share' })).toBeNull()
+ expect(screen.queryByRole('checkbox', { name: /Include contents/ })).toBeNull()
await chooseSubjects('Ada Lovelace', 'Research')
- selectPermission('Read')
- selectPermission('Write')
-
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
- const dialog = await screen.findByRole('alertdialog')
- expect(dialog).toHaveTextContent('2 recipients (1 user, 1 team)')
- expect(dialog).toHaveTextContent('"reports"')
- expect(dialog).toHaveTextContent('Permissions: read, write')
- expect(dialog).toHaveTextContent('Scope: this resource and all descendants')
- fireEvent.click(within(dialog).getByRole('button', { name: 'Cancel' }))
- await waitFor(() => expect(screen.queryByRole('alertdialog')).toBeNull())
- expect(mockPutGfsGrant).not.toHaveBeenCalled()
+ expect(screen.getByRole('button', { name: 'Share' })).toBeEnabled()
+ expect(screen.getByRole('checkbox', { name: /Include contents/ })).toBeChecked()
+ expect(
+ screen.getByRole('combobox', { name: 'Access role for selected recipients' })
+ ).toHaveValue('read')
})
it('keeps operator singular and prevents mixing it with bulk subjects', async () => {
@@ -382,14 +402,14 @@ describe('GfsGrantPanel bulk access', () => {
expect(screen.queryByRole('button', { name: 'Remove Ada Lovelace' })).toBeNull()
expect(screen.getByRole('button', { name: 'Remove Operator' })).toBeTruthy()
selectPermission('Read')
- await submit('Grant access')
+ await submit('Share')
await waitFor(() =>
expect(mockPutGfsGrant).toHaveBeenCalledWith({
drive: 'main',
resourceId: resource.resourceId,
subject: { type: 'operator' },
- permissions: ['read'],
+ permissions: ['read', 'share'],
inherit: false,
})
)
@@ -408,23 +428,23 @@ describe('GfsGrantPanel bulk access', () => {
renderPanel()
await chooseSubjects('Ada Lovelace', 'Research')
selectPermission('Write')
- await submit('Grant access')
+ await submit('Share')
expect(await screen.findByRole('alert')).toHaveTextContent(
'escalation_rejected: Requested permissions exceed operator authority. (invalid indexes: 1)'
)
expect(screen.getByRole('button', { name: 'Remove Ada Lovelace' })).toBeTruthy()
expect(screen.getByRole('button', { name: 'Remove Research' })).toBeTruthy()
- expect(document.querySelector('.cu-gfs-permission-dropdown__trigger')).toHaveTextContent(
- 'Write'
- )
+ expect(
+ screen.getByRole('combobox', { name: 'Access role for selected recipients' })
+ ).toHaveValue('editor')
- await submit('Grant access')
+ await submit('Share')
await waitFor(() => expect(mockPutGfsGrant).toHaveBeenCalledTimes(2))
expect(screen.queryByRole('button', { name: 'Remove Ada Lovelace' })).toBeNull()
- expect(document.querySelector('.cu-gfs-permission-dropdown__trigger')).toHaveTextContent(
- 'Permissions'
- )
+ expect(
+ screen.queryByRole('combobox', { name: 'Access role for selected recipients' })
+ ).toBeNull()
})
it('does not duplicate the machine code when the server message matches it', async () => {
@@ -437,27 +457,25 @@ describe('GfsGrantPanel bulk access', () => {
renderPanel()
await chooseSubjects('Ada Lovelace')
selectPermission('Read')
- await submit('Grant access')
+ await submit('Share')
const alert = await screen.findByRole('alert')
expect(alert).toHaveTextContent('subjects_invalid')
expect(alert).not.toHaveTextContent('subjects_invalid: subjects_invalid')
})
- it('does not restore incompatible permissions after the final host is removed', async () => {
+ it('adapts the Editor role to the read/write-only host permission model', async () => {
renderPanel()
await chooseSubjects('Ada Lovelace')
- selectPermission('Delete')
+ selectPermission('Editor')
await chooseSubjects('chatllm (Stateful)')
- expect(
- within(openPermissionMenu()).queryByRole('menuitemcheckbox', { name: 'Delete' })
- ).toBeNull()
+ expect(screen.getByText(/use read\/write access only/i)).toBeTruthy()
fireEvent.click(screen.getByRole('button', { name: 'Remove chatllm (Stateful)' }))
expect(
- within(openPermissionMenu()).getByRole('menuitemcheckbox', { name: 'Delete' })
- ).not.toBeChecked()
+ screen.getByRole('combobox', { name: 'Access role for selected recipients' })
+ ).toHaveValue('editor')
selectPermission('Read')
})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 55be3fcb1..c5cdd591f 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.502",
+ "version": "0.1.503",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.502",
+ "version": "0.1.503",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/llm-providers": "file:../packages/llm-providers",
diff --git a/control-ui/package.json b/control-ui/package.json
index e3c1f6208..5f77ef42a 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.502",
+ "version": "0.1.503",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/desktop-app/ui/src/gfs/GfsGrantList/index.tsx b/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
index 45af8572c..73cf403cb 100644
--- a/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
+++ b/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
@@ -1,5 +1,4 @@
-import { Badge, IconButton, Pill, StatusBanner } from '@components/Common'
-import { GFS_PERMISSION_LABELS } from '@/gfs/GfsPermissionDropdown/constants'
+import { Badge, IconButton, SelectInput, StatusBanner } from '@components/Common'
import type {
GfsAgentSubjectOption,
GfsDelegationSubjectOption,
@@ -7,6 +6,7 @@ import type {
GfsShareListItem,
} from '@/gfs/delegation.types'
import type { GfsGrantListProps } from './types'
+import type { GfsAccessRole } from './types'
/**
* "Who has access" — the resource's current grants, sourced from the user-plane
@@ -36,6 +36,12 @@ function subjectLabel(
return subject.id ?? subject.type
}
+function roleForPermissions(permissions: string[]): GfsAccessRole {
+ return permissions.some(permission => ['write', 'delete', 'manage_acl'].includes(permission))
+ ? 'editor'
+ : 'read'
+}
+
export function GfsGrantList({
items,
shares = [],
@@ -45,9 +51,11 @@ export function GfsGrantList({
agents,
subjects,
onRevoke,
+ onChangeRole,
onRevokeShare,
revoking = false,
revokingShare = false,
+ updatingRole = false,
}: GfsGrantListProps) {
// Grants and shares are independent server surfaces with independent
// failure modes (R4 spec §2): one list's error suppresses only its own rows
@@ -93,13 +101,23 @@ export function GfsGrantList({
</span>
</span>
<span className="da-gfs-grant-list__meta">
- <span className="da-gfs-grant-list__chips">
- {item.permissions.map(permission => (
- <Pill key={permission} size="xs" tone="neutral">
- {GFS_PERMISSION_LABELS[permission] ?? permission}
- </Pill>
- ))}
- </span>
+ <SelectInput
+ aria-label={`Access role for ${label}`}
+ className="da-gfs-grant-list__role"
+ dense
+ disabled={updatingRole || !onChangeRole}
+ onChange={event =>
+ void onChangeRole?.(
+ item,
+ label,
+ event.currentTarget.value as GfsAccessRole
+ )
+ }
+ value={roleForPermissions(item.permissions)}
+ >
+ <option value="read">Read</option>
+ <option value="editor">Editor</option>
+ </SelectInput>
{item.inherit ? <Badge tone="accent">Includes contents</Badge> : null}
</span>
<IconButton
@@ -134,12 +152,8 @@ export function GfsGrantList({
</span>
</span>
<span className="da-gfs-grant-list__meta">
- <span className="da-gfs-grant-list__chips">
- {item.permissions.map(permission => (
- <Pill key={permission} size="xs" tone="neutral">
- {GFS_PERMISSION_LABELS[permission] ?? permission}
- </Pill>
- ))}
+ <span className="da-gfs-grant-list__role-label">
+ {roleForPermissions(item.permissions) === 'editor' ? 'Editor' : 'Read'}
</span>
{item.includeDescendants ? (
<Badge tone="accent">Includes contents</Badge>
@@ -173,4 +187,4 @@ export function GfsGrantList({
)
}
-export type { GfsGrantListProps } from './types'
+export type { GfsAccessRole, GfsGrantListProps } from './types'
diff --git a/desktop-app/ui/src/gfs/GfsGrantList/types.ts b/desktop-app/ui/src/gfs/GfsGrantList/types.ts
index 099234b1f..5f4c1fc8b 100644
--- a/desktop-app/ui/src/gfs/GfsGrantList/types.ts
+++ b/desktop-app/ui/src/gfs/GfsGrantList/types.ts
@@ -6,6 +6,8 @@ import type {
GfsShareListItem,
} from '@/gfs/delegation.types'
+export type GfsAccessRole = 'read' | 'editor'
+
export interface GfsGrantListProps {
items: GfsGrantListItem[]
shares?: GfsShareListItem[]
@@ -21,7 +23,13 @@ export interface GfsGrantListProps {
/** Label source for `user`/`team` subjects (the visible team directory). */
subjects: GfsDelegationSubjectOption[]
onRevoke: (item: GfsGrantListItem, label: string) => void | Promise<void>
+ onChangeRole?: (
+ item: GfsGrantListItem,
+ label: string,
+ role: GfsAccessRole
+ ) => void | Promise<void>
onRevokeShare?: (item: GfsShareListItem, label: string) => void | Promise<void>
revoking?: boolean
revokingShare?: boolean
+ updatingRole?: boolean
}
diff --git a/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx b/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
index c6ffbc8ed..2cefbff28 100644
--- a/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
+++ b/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
@@ -44,7 +44,7 @@ function shareItem(overrides: Partial<GfsShareListItem>): GfsShareListItem {
}
describe('GfsGrantList', () => {
- it('renders resolved subject labels, permission chips, and the inherit badge', () => {
+ it('renders resolved subject labels, grouped roles, and the inherit badge', () => {
render(
<GfsGrantList
agents={agents}
@@ -63,8 +63,13 @@ describe('GfsGrantList', () => {
)
const agentRow = screen.getByText('Chat LLM').closest('li')!
- expect(within(agentRow).getByText('Read')).toBeTruthy()
- expect(within(agentRow).getByText('Write')).toBeTruthy()
+ expect(
+ (
+ within(agentRow).getByRole('combobox', {
+ name: 'Access role for Chat LLM',
+ }) as HTMLSelectElement
+ ).value
+ ).toBe('editor')
expect(within(agentRow).getByText('Includes contents')).toBeTruthy()
expect(within(agentRow).getByText('X')).toBeTruthy()
expect(
@@ -72,7 +77,13 @@ describe('GfsGrantList', () => {
).toContain('da-gfs-grant-list__revoke')
const userRow = screen.getByText('Test Two').closest('li')!
- expect(within(userRow).getByText('Read')).toBeTruthy()
+ expect(
+ (
+ within(userRow).getByRole('combobox', {
+ name: 'Access role for Test Two',
+ }) as HTMLSelectElement
+ ).value
+ ).toBe('read')
expect(within(userRow).queryByText('Includes contents')).toBeNull()
// Unresolvable subject ids stay visible as raw ids — never hidden.
@@ -111,6 +122,25 @@ describe('GfsGrantList', () => {
expect(onRevoke).toHaveBeenCalledWith(item, 'Chat LLM')
})
+ it('changes a member between the grouped Read and Editor roles', () => {
+ const onChangeRole = vi.fn()
+ const item = grantItem({ subject: { type: 'user', id: 'user-2' } })
+ render(
+ <GfsGrantList
+ agents={agents}
+ items={[item]}
+ onChangeRole={onChangeRole}
+ onRevoke={vi.fn()}
+ subjects={subjects}
+ />
+ )
+
+ fireEvent.change(screen.getByRole('combobox', { name: 'Access role for Test Two' }), {
+ target: { value: 'editor' },
+ })
+ expect(onChangeRole).toHaveBeenCalledWith(item, 'Test Two', 'editor')
+ })
+
it('combines direct shares with grants and routes share revoke separately', () => {
const onRevoke = vi.fn()
const onRevokeShare = vi.fn()
diff --git a/desktop-app/ui/src/gfs/__tests__/delegation.test.tsx b/desktop-app/ui/src/gfs/__tests__/delegation.test.tsx
index 3bdfe6e58..65c5ea22f 100644
--- a/desktop-app/ui/src/gfs/__tests__/delegation.test.tsx
+++ b/desktop-app/ui/src/gfs/__tests__/delegation.test.tsx
@@ -46,19 +46,19 @@ describe('GfsDelegationPanel', () => {
onGrant={onGrant}
/>
)
- fireEvent.click(screen.getByRole('button', { name: 'Read' }))
- // Only held bits are rendered as toggles — write/delete are NOT offered.
- expect(screen.getByRole('menuitemcheckbox', { name: 'Read' })).toBeTruthy()
- expect(screen.getByRole('menuitemcheckbox', { name: 'Manage access' })).toBeTruthy()
- expect(screen.queryByRole('menuitemcheckbox', { name: 'Edit' })).toBeNull()
- expect(screen.queryByRole('button', { name: 'Create share' })).toBeNull()
+ expect(screen.queryByRole('button', { name: 'Share' })).toBeNull()
+ expect(screen.queryByRole('button', { name: 'Access role for selected recipients' })).toBeNull()
fireEvent.focus(screen.getByRole('combobox', { name: PICKER_LABEL }))
fireEvent.click(screen.getByRole('option', { name: /Delegate User/ }))
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Access role for selected recipients' }))
+ fireEvent.click(screen.getByRole('option', { name: 'Editor' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
// Files never send inherit.
- await waitFor(() => expect(onGrant).toHaveBeenCalledWith(['user:u2'], ['read'], false))
+ await waitFor(() =>
+ expect(onGrant).toHaveBeenCalledWith(['user:u2'], ['read', 'manage_acl'], false)
+ )
})
it('surfaces a server no-escalation rejection mapped to its human message (fail-loud)', async () => {
@@ -75,7 +75,7 @@ describe('GfsDelegationPanel', () => {
)
fireEvent.focus(screen.getByRole('combobox', { name: PICKER_LABEL }))
fireEvent.click(screen.getByRole('option', { name: /Delegate User/ }))
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
// The panel maps the server code via describeGfsGrantError — never the raw code.
const alert = await screen.findByText('You can only grant permissions you already hold here.')
@@ -93,7 +93,8 @@ describe('GfsDelegationPanel', () => {
)
expect(screen.getByRole('combobox', { name: PICKER_LABEL })).toHaveProperty('tagName', 'INPUT')
- expect(screen.getByRole('button', { name: 'Grant access' })).toHaveProperty('disabled', true)
+ expect(screen.queryByRole('button', { name: 'Share' })).toBeNull()
+ expect(screen.queryByRole('button', { name: 'Access role for selected recipients' })).toBeNull()
expect(screen.queryByPlaceholderText(/uuid/i)).toBeNull()
})
@@ -139,7 +140,7 @@ describe('GfsDelegationPanel', () => {
fireEvent.focus(picker)
fireEvent.click(screen.getByRole('option', { name: /Successful User/ }))
fireEvent.click(screen.getByRole('option', { name: /Blocked Team/ }))
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
await screen.findByText('Some selected subjects are invalid and were rejected.')
expect(onGrant).toHaveBeenCalledTimes(1)
@@ -165,23 +166,17 @@ describe('GfsDelegationPanel', () => {
/>
)
- // Hold a bit a host cannot receive, then add the host.
- fireEvent.click(screen.getByRole('button', { name: 'Read' })) // open the dropdown
- fireEvent.click(screen.getByRole('menuitemcheckbox', { name: 'Manage access' }))
-
fireEvent.focus(screen.getByRole('combobox', { name: PICKER_LABEL }))
fireEvent.click(screen.getByRole('option', { name: /chatllm/ }))
- // Hint explains the cap; manage_acl has been stripped (the trigger summary
- // is back to a single bit, not "2 permissions") and hosts can't be shared to.
- expect(screen.getByText(/limited to read and write/i)).toBeTruthy()
- expect(screen.getByRole('button', { name: 'Read' })).toBeTruthy()
- expect(screen.queryByRole('button', { name: /2 permissions/ })).toBeNull()
- expect(screen.queryByRole('button', { name: 'Create share' })).toBeNull()
+ expect(screen.getByText(/use read\/write access only/i)).toBeTruthy()
+ fireEvent.click(screen.getByRole('button', { name: 'Access role for selected recipients' }))
+ expect(screen.getByRole('option', { name: 'Read' })).toBeTruthy()
+ fireEvent.click(screen.getByRole('option', { name: 'Editor' }))
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
await waitFor(() =>
- expect(onGrant).toHaveBeenCalledWith(['host:1st:mcp-host/chatllm'], ['read'], false)
+ expect(onGrant).toHaveBeenCalledWith(['host:1st:mcp-host/chatllm'], ['read', 'write'], false)
)
})
@@ -196,22 +191,22 @@ describe('GfsDelegationPanel', () => {
/>
)
- const toggle = screen.getByRole('checkbox', { name: 'Include contents of this folder' })
- expect(toggle).toHaveProperty('checked', true)
-
const picker = screen.getByRole('combobox', { name: PICKER_LABEL })
fireEvent.focus(picker)
fireEvent.click(screen.getByRole('option', { name: /Delegate User/ }))
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
+ const toggle = screen.getByRole('checkbox', { name: 'Include contents of this folder' })
+ expect(toggle).toHaveProperty('checked', true)
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
await waitFor(() => expect(onGrant).toHaveBeenCalledWith(['user:u2'], ['read'], true))
// The panel clears the selection after a successful grant, so re-pick before
// proving the unchecked toggle sends inherit=false.
fireEvent.focus(picker)
fireEvent.click(screen.getByRole('option', { name: /Delegate User/ }))
- fireEvent.click(toggle)
- expect(toggle).toHaveProperty('checked', false)
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
+ const secondToggle = screen.getByRole('checkbox', { name: 'Include contents of this folder' })
+ fireEvent.click(secondToggle)
+ expect(secondToggle).toHaveProperty('checked', false)
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
await waitFor(() => expect(onGrant).toHaveBeenNthCalledWith(2, ['user:u2'], ['read'], false))
})
diff --git a/desktop-app/ui/src/gfs/delegation.tsx b/desktop-app/ui/src/gfs/delegation.tsx
index 1ce190f70..5d3399870 100644
--- a/desktop-app/ui/src/gfs/delegation.tsx
+++ b/desktop-app/ui/src/gfs/delegation.tsx
@@ -1,7 +1,6 @@
-import { useState } from 'react'
-import { Button, StatusBanner } from '@components/Common'
+import { useEffect, useState } from 'react'
+import { Button, DropdownSelect, StatusBanner } from '@components/Common'
import { describeGfsGrantError } from '@lib/gfsGrantErrors'
-import { GfsPermissionDropdown } from '@/gfs/GfsPermissionDropdown'
import { GfsSubjectPicker } from '@/gfs/GfsSubjectPicker'
import type { GfsDelegationPanelProps } from './delegation.types'
@@ -10,9 +9,28 @@ import type { GfsDelegationPanelProps } from './delegation.types'
* (`managed_agent_permission_forbidden`) — when the selection contains a host,
* the dropdown never offers more, and any incompatible held bits are stripped.
*/
-const HOST_PERMISSION_BITS = ['read', 'write'] as const
-
const HOST_SUBJECT_KEY_PREFIX = 'host:'
+type AccessRole = 'read' | 'editor'
+
+const ROLE_OPTIONS = [
+ { value: 'read', label: 'Read' },
+ { value: 'editor', label: 'Editor' },
+]
+
+function permissionsForRole(
+ role: AccessRole,
+ hostOnly: boolean,
+ grantableBits: string[]
+): string[] {
+ const requested = hostOnly
+ ? role === 'editor'
+ ? ['read', 'write']
+ : ['read']
+ : role === 'editor'
+ ? ['read', 'write', 'delete', 'manage_acl', 'share']
+ : ['read', 'share']
+ return requested.filter(permission => grantableBits.includes(permission))
+}
/**
* P4-S07 — Desktop gfs delegation panel (renderer). A folder owner delegates
@@ -37,11 +55,10 @@ export function GfsDelegationPanel({
subjectOptionsError = null,
isDirectory,
onGrant,
+ onDetailViewChange,
}: GfsDelegationPanelProps) {
const [subjectKeys, setSubjectKeys] = useState<string[]>([])
- const [bits, setBits] = useState<string[]>(() =>
- affordances.grantableBits.includes('read') ? ['read'] : affordances.grantableBits.slice(0, 1)
- )
+ const [role, setRole] = useState<AccessRole>('read')
const [inherit, setInherit] = useState(true)
const [busy, setBusy] = useState(false)
const [error, setError] = useState<string | null>(null)
@@ -51,19 +68,18 @@ export function GfsDelegationPanel({
// Hosts cap the WHOLE bulk grant to read/write (the server enforces this per
// host subject; the bulk request is atomic, so the cap applies to all). Also
// keep the cap within the bits the caller actually holds.
- const visiblePermissionBits = hasHost
- ? HOST_PERMISSION_BITS.filter(bit => grantableBits.includes(bit))
- : grantableBits
+ const bits = permissionsForRole(role, hasHost, grantableBits)
+ const canOfferEditor = (hasHost ? ['write'] : ['write', 'delete', 'manage_acl']).some(bit =>
+ grantableBits.includes(bit)
+ )
+ const roleOptions = canOfferEditor ? ROLE_OPTIONS : ROLE_OPTIONS.slice(0, 1)
+
+ useEffect(() => {
+ onDetailViewChange?.(subjectKeys.length > 0)
+ }, [onDetailViewChange, subjectKeys.length])
+
function changeSubjects(nextKeys: string[]) {
setSubjectKeys(nextKeys)
- const nextHasHost = nextKeys.some(key => key.startsWith(HOST_SUBJECT_KEY_PREFIX))
- if (!nextHasHost) return
- // Drop any bit a host subject cannot receive so the bulk grant stays valid.
- const allowed: string[] = HOST_PERMISSION_BITS.filter(bit => grantableBits.includes(bit))
- setBits(current => {
- const filtered = current.filter(bit => allowed.includes(bit))
- return filtered.length === current.length ? current : filtered
- })
}
async function run(action: () => Promise<void>) {
@@ -72,6 +88,7 @@ export function GfsDelegationPanel({
try {
await action()
setSubjectKeys([])
+ setRole('read')
} catch (e) {
// The bulk grant is atomic — a failure means NONE of the subjects landed,
// so keep the whole selection for a retry. Surface the server's
@@ -94,7 +111,9 @@ export function GfsDelegationPanel({
}
return (
- <div className="da-gfs-delegation">
+ <div
+ className={`da-gfs-delegation${subjectKeys.length > 0 ? ' da-gfs-delegation--details' : ''}`}
+ >
<div className="da-gfs-delegation__composer">
<GfsSubjectPicker
disabled={busy}
@@ -103,42 +122,59 @@ export function GfsDelegationPanel({
options={subjectOptions}
value={subjectKeys}
/>
- <GfsPermissionDropdown
- disabled={busy}
- onChange={setBits}
- permissions={visiblePermissionBits}
- value={bits}
- />
+ {subjectKeys.length > 0 ? (
+ <DropdownSelect
+ ariaLabel="Access role for selected recipients"
+ disabled={busy}
+ onChange={value => setRole(value as AccessRole)}
+ options={roleOptions}
+ placeholder="Role"
+ value={role}
+ />
+ ) : null}
</div>
- {hasHost ? (
+ {subjectKeys.length > 0 && hasHost ? (
<p className="da-gfs-delegation__hint muted">
- Agent selections are limited to read and write. Incompatible permissions were removed.
+ Agents, workflows, and plugins use read/write access only.
</p>
) : null}
{subjectOptionsError ? <StatusBanner tone="error" text={subjectOptionsError} /> : null}
- <div className="da-gfs-delegation__scope-actions">
- {isDirectory ? (
- <label className="da-gfs-delegation__inherit">
- <input
- checked={inherit}
+ {subjectKeys.length > 0 ? (
+ <div className="da-gfs-delegation__scope-actions">
+ {isDirectory ? (
+ <label className="da-gfs-delegation__inherit">
+ <input
+ checked={inherit}
+ disabled={busy}
+ onChange={event => setInherit(event.target.checked)}
+ type="checkbox"
+ />
+ <span>Include contents of this folder</span>
+ </label>
+ ) : null}
+ <div className="da-gfs-delegation__actions">
+ <Button
disabled={busy}
- onChange={event => setInherit(event.target.checked)}
- type="checkbox"
- />
- <span>Include contents of this folder</span>
- </label>
- ) : null}
- <div className="da-gfs-delegation__actions">
- <Button
- type="button"
- loading={busy}
- disabled={busy || subjectKeys.length === 0 || bits.length === 0}
- onClick={() => run(() => onGrant(subjectKeys, bits, isDirectory ? inherit : false))}
- >
- Grant access
- </Button>
+ onClick={() => {
+ setSubjectKeys([])
+ setRole('read')
+ }}
+ type="button"
+ variant="ghost"
+ >
+ Back
+ </Button>
+ <Button
+ type="button"
+ loading={busy}
+ disabled={busy || bits.length === 0}
+ onClick={() => run(() => onGrant(subjectKeys, bits, isDirectory ? inherit : false))}
+ >
+ Share
+ </Button>
+ </div>
</div>
- </div>
+ ) : null}
{error !== null && <StatusBanner tone="error" text={error} />}
</div>
)
diff --git a/desktop-app/ui/src/gfs/delegation.types.ts b/desktop-app/ui/src/gfs/delegation.types.ts
index e692a1c54..5fd9ef487 100644
--- a/desktop-app/ui/src/gfs/delegation.types.ts
+++ b/desktop-app/ui/src/gfs/delegation.types.ts
@@ -23,6 +23,7 @@ export interface GfsDelegationPanelProps {
/** Directories offer the "Include contents" toggle (default ON); files always send inherit=false. */
isDirectory: boolean
onGrant: (subjectKeys: string[], bits: string[], inherit: boolean) => Promise<void>
+ onDetailViewChange?: (open: boolean) => void
}
/**
diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsx
index 0788dcb6c..6f6fe2d62 100644
--- a/desktop-app/ui/src/pages/FilesPage.tsx
+++ b/desktop-app/ui/src/pages/FilesPage.tsx
@@ -36,10 +36,12 @@ import { isGfsMarkdownPreviewFile } from '@lib/gfsMarkdownPreview'
import { gfsVideoPreviewMimeType } from '@lib/gfsVideoPreview'
import { formatSharedFileSize } from '@lib/sharedFiles'
import { GfsGrantList } from '@/gfs/GfsGrantList'
+import type { GfsAccessRole } from '@/gfs/GfsGrantList'
import {
type GfsAgentSubjectOption,
GfsDelegationPanel,
type GfsDelegationSubjectOption,
+ type GfsGrantListItem,
} from '@/gfs/delegation'
import { GfsFilePicker } from '@/gfs/filePicker'
import { GfsMoveDialog } from '@/gfs/moveDialog'
@@ -239,6 +241,8 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
const [renameDraft, setRenameDraft] = useState('')
const [openLinkOpen, setOpenLinkOpen] = useState(false)
const [manageOpen, setManageOpen] = useState(false)
+ const [shareDetailsOpen, setShareDetailsOpen] = useState(false)
+ const [updatingAccessRole, setUpdatingAccessRole] = useState(false)
const [filePreview, setFilePreview] = useState<GfsPreviewResource | null>(null)
const [dragActive, setDragActive] = useState(false)
const [droppedUploadCount, setDroppedUploadCount] = useState(0)
@@ -509,6 +513,36 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
}
}
+ const handleAccessRoleChange = async (
+ item: GfsGrantListItem,
+ label: string,
+ role: GfsAccessRole
+ ) => {
+ const requested =
+ item.subject.type === 'host'
+ ? role === 'editor'
+ ? ['read', 'write']
+ : ['read']
+ : role === 'editor'
+ ? ['read', 'write', 'delete', 'manage_acl', 'share']
+ : ['read', 'share']
+ const bits = requested.filter(bit => affordances?.grantableBits.includes(bit))
+ const subjectKey = item.subject.id
+ ? `${item.subject.type}:${item.subject.id}`
+ : item.subject.type
+ setUpdatingAccessRole(true)
+ try {
+ await ctrl.grant([subjectKey], bits, item.inherit)
+ pushToast?.(`${label} is now ${role === 'editor' ? 'an Editor' : 'Read-only'}`, 'success')
+ await ctrl.refreshGrants()
+ } catch (roleError) {
+ if (failClosedOnAuthorizationError(roleError)) return
+ pushToast?.(describeGfsGrantError(roleError).message, 'error')
+ } finally {
+ setUpdatingAccessRole(false)
+ }
+ }
+
const handleDownload = async (uri: string, name: string) => {
try {
const { bytes } = await window.clerum.gfs.download(uri)
@@ -996,6 +1030,7 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
setCreateFolderOpen(false)
setRenameOpen(false)
setDeleteOpen(false)
+ setShareDetailsOpen(false)
setManageOpen(true)
}
@@ -1516,7 +1551,7 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
className="da-gfs-manage-dialog"
role="dialog"
aria-modal="true"
- aria-label={`Manage ${currentIsFolder ? 'folder' : 'file'} ${current.name}`}
+ aria-label={`Share ${currentIsFolder ? 'folder' : 'file'} ${current.name}`}
>
<header className="da-gfs-manage-dialog__header">
<span
@@ -1555,7 +1590,7 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
</form>
) : (
<span className="da-gfs-manage-dialog__title-row">
- <h3>{current.name}</h3>
+ <h3>Share “{current.name}”</h3>
<GfsResourceMenu
resourceName={current.name}
onCopyLink={() => void handleCopyLink(current.gfsUri)}
@@ -1614,7 +1649,7 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
) : null}
<IconButton
autoFocus
- label="Close manage dialog"
+ label="Close share dialog"
onClick={closeManage}
size="sm"
variant="ghost"
@@ -1703,8 +1738,7 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
<section className="da-gfs-manage-section da-gfs-manage-section--access">
<div className="da-gfs-manage-section__header">
<div>
- <h4>Access</h4>
- <p className="muted">Control who can use this resource and what they can do.</p>
+ <h4>Add people, teams, agents, or workflows</h4>
</div>
</div>
{loadingAffordances ? (
@@ -1725,6 +1759,7 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
)}
isDirectory={currentIsFolder}
onGrant={handleGrant}
+ onDetailViewChange={setShareDetailsOpen}
/>
</>
) : (
@@ -1732,29 +1767,30 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
)}
</section>
- <section className="da-gfs-manage-section da-gfs-manage-section--grants">
- <div className="da-gfs-manage-section__header">
- <div>
- <h4>Who has access</h4>
- <p className="muted">
- Existing direct grants and shares on this resource. Revoking is immediate.
- </p>
+ {!shareDetailsOpen ? (
+ <section className="da-gfs-manage-section da-gfs-manage-section--grants">
+ <div className="da-gfs-manage-section__header">
+ <div>
+ <h4>People with access</h4>
+ </div>
</div>
- </div>
- <GfsGrantList
- agents={agentSubjects}
- error={grantsError}
- items={ctrl.grants}
- loading={ctrl.loadingGrants || ctrl.loadingShares}
- onRevoke={(item, label) => void handleRevokeGrant(item.id, label)}
- onRevokeShare={(item, label) => void handleRevokeShare(item.id, label)}
- revoking={ctrl.revoking}
- revokingShare={ctrl.revokingShare}
- shareError={sharesError}
- shares={ctrl.shares}
- subjects={delegationSubjects}
- />
- </section>
+ <GfsGrantList
+ agents={agentSubjects}
+ error={grantsError}
+ items={ctrl.grants}
+ loading={ctrl.loadingGrants || ctrl.loadingShares}
+ onChangeRole={affordances?.canDelegate ? handleAccessRoleChange : undefined}
+ onRevoke={(item, label) => void handleRevokeGrant(item.id, label)}
+ onRevokeShare={(item, label) => void handleRevokeShare(item.id, label)}
+ revoking={ctrl.revoking}
+ revokingShare={ctrl.revokingShare}
+ shareError={sharesError}
+ shares={ctrl.shares}
+ subjects={delegationSubjects}
+ updatingRole={updatingAccessRole}
+ />
+ </section>
+ ) : null}
</div>
</section>
</div>
diff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
index deb11016e..39488cc99 100644
--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
@@ -106,7 +106,7 @@ async function openManageDialog(resourceName: string) {
}
async function chooseManageAction(resourceName: string, actionName: string) {
- const dialog = screen.getByRole('dialog', { name: new RegExp(`Manage .* ${resourceName}`) })
+ const dialog = screen.getByRole('dialog', { name: new RegExp(`Share .* ${resourceName}`) })
await act(async () => {
fireEvent.click(within(dialog).getByRole('button', { name: `Options for ${resourceName}` }))
})
@@ -618,7 +618,7 @@ describe('FilesPage', () => {
renderFilesPage()
await openManageDialog('Team folder')
- const dialog = screen.getByRole('dialog', { name: 'Manage folder Team folder' })
+ const dialog = screen.getByRole('dialog', { name: 'Share folder Team folder' })
expect(within(dialog).queryByRole('button', { name: 'Upload file' })).toBeNull()
expect(within(dialog).queryByLabelText('Upload file')).toBeNull()
})
@@ -1233,7 +1233,7 @@ describe('FilesPage', () => {
// The manage modal opens (titled for the current selection — the mocked
// controller does not navigate, so it stays on the parent folder).
expect(screen.getByRole('dialog')).toBeTruthy()
- expect(screen.getByRole('heading', { name: 'Who has access' })).toBeTruthy()
+ expect(screen.getByRole('heading', { name: 'People with access' })).toBeTruthy()
})
it('returns to Shared with me after closing Manage for a file row', async () => {
@@ -1291,7 +1291,7 @@ describe('FilesPage', () => {
renderFilesPage()
await openManageDialog('report.txt')
- fireEvent.click(screen.getByRole('button', { name: 'Close manage dialog' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Close share dialog' }))
await waitFor(() => expect(restoreCrumbs).toHaveBeenCalledWith([]))
expect(screen.getByRole('button', { name: 'report.txt' })).toBeTruthy()
@@ -1440,9 +1440,7 @@ describe('FilesPage', () => {
fireEvent.focus(picker)
expect(await screen.findByRole('option', { name: /chatllm/ })).toBeTruthy()
expect(screen.queryByRole('option', { name: /pending-agent/ })).toBeNull()
- expect(
- screen.getByRole('checkbox', { name: 'Include contents of this folder' })
- ).toHaveProperty('checked', true)
+ expect(screen.queryByRole('checkbox', { name: 'Include contents of this folder' })).toBeNull()
})
it('refetches the grants list after a successful agent grant', async () => {
@@ -1489,7 +1487,7 @@ describe('FilesPage', () => {
const picker = await screen.findByRole('combobox', { name: 'Add people, teams, or agents' })
fireEvent.focus(picker)
fireEvent.click(await screen.findByRole('option', { name: /chatllm/ }))
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
await waitFor(() =>
expect(grant).toHaveBeenCalledWith(['host:1st:mcp-host/chatllm'], ['read'], true)
@@ -1555,7 +1553,7 @@ describe('FilesPage', () => {
})
fireEvent.focus(subjectPicker)
fireEvent.click(await screen.findByRole('option', { name: /Test Two/ }))
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
// handleGrant issues the grant then MUST list-after-write (the grant PUT
// returns no ids). Deleting `await ctrl.refreshGrants()` must fail here.
@@ -1612,7 +1610,7 @@ describe('FilesPage', () => {
renderFilesPage(pushToast)
await openManageDialog('Team folder')
- const dialog = screen.getByRole('dialog', { name: 'Manage folder Team folder' })
+ const dialog = screen.getByRole('dialog', { name: 'Share folder Team folder' })
const menuTrigger = within(dialog).getByRole('button', { name: 'Options for Team folder' })
await act(async () => {
fireEvent.click(menuTrigger)
@@ -1687,7 +1685,7 @@ describe('FilesPage', () => {
fireEvent.focus(subjectPicker)
fireEvent.click(await screen.findByRole('option', { name: /Test Two/ }))
fireEvent.click(await screen.findByRole('option', { name: /Test Three/ }))
- fireEvent.click(screen.getByRole('button', { name: 'Grant access' }))
+ fireEvent.click(screen.getByRole('button', { name: 'Share' }))
await waitFor(() =>
expect(grant).toHaveBeenCalledWith(['user:user-2', 'user:user-3'], ['read'], true)
@@ -1756,6 +1754,67 @@ describe('FilesPage', () => {
)
})
+ it('changes an existing agent from Read to Editor using read/write only', async () => {
+ Object.defineProperty(window, 'clerum', {
+ configurable: true,
+ value: {
+ agents: {
+ listMine: vi.fn(async () => [
+ {
+ name: 'chatllm',
+ contextRef: 'ctx-1',
+ mcpServers: [],
+ gfsSubject: { type: 'host', id: '1st:mcp-host/chatllm' },
+ },
+ ]),
+ },
+ team: { directory: vi.fn(async () => ({ currentTeamId: 'team-1', items: [] })) },
+ },
+ })
+ const grant = vi.fn(async () => undefined)
+ const refreshGrants = vi.fn(async () => undefined)
+ const pushToast = vi.fn()
+ hookMock.useGfsBrowserController.mockReturnValue({
+ ...baseController(),
+ current: {
+ resourceId: 'folder-1',
+ gfsUri: 'gfs://main/folder',
+ name: 'Team folder',
+ kind: 'directory',
+ },
+ affordances: {
+ held: ['read', 'write', 'manage_acl'],
+ canDelegate: true,
+ grantableBits: ['read', 'write'],
+ canCreateShare: false,
+ },
+ grants: [
+ {
+ id: 'grant-1',
+ drive: 'main',
+ resourceId: 'folder-1',
+ subject: { type: 'host', id: '1st:mcp-host/chatllm' },
+ permissions: ['read'],
+ inherit: true,
+ },
+ ],
+ grant,
+ refreshGrants,
+ })
+
+ renderFilesPage(pushToast)
+ await openManageDialog('Team folder')
+ fireEvent.change(await screen.findByRole('combobox', { name: 'Access role for chatllm' }), {
+ target: { value: 'editor' },
+ })
+
+ await waitFor(() =>
+ expect(grant).toHaveBeenCalledWith(['host:1st:mcp-host/chatllm'], ['read', 'write'], true)
+ )
+ expect(refreshGrants).toHaveBeenCalledTimes(1)
+ expect(pushToast).toHaveBeenCalledWith('chatllm is now an Editor', 'success')
+ })
+
it('lists direct shares in the who-has-access list and revokes them', async () => {
Object.defineProperty(window, 'clerum', {
configurable: true,
@@ -1926,7 +1985,7 @@ describe('FilesPage', () => {
await openManageDialog('Product')
await act(async () => {
fireEvent.click(
- within(screen.getByRole('dialog', { name: 'Manage folder Product' })).getByRole('button', {
+ within(screen.getByRole('dialog', { name: 'Share folder Product' })).getByRole('button', {
name: 'Options for Product',
})
)
@@ -1943,7 +2002,7 @@ describe('FilesPage', () => {
expect(screen.queryByRole('dialog', { name: 'Move folder Product' })).toBeNull()
)
await waitFor(() =>
- expect(screen.queryByRole('dialog', { name: 'Manage folder Product' })).toBeNull()
+ expect(screen.queryByRole('dialog', { name: 'Share folder Product' })).toBeNull()
)
expect(await screen.findByText('File access is not authorized')).toBeTruthy()
expect(moveResource).not.toHaveBeenCalled()
diff --git a/desktop-app/ui/src/styles.css b/desktop-app/ui/src/styles.css
index 05e3307f4..e62095cb2 100644
--- a/desktop-app/ui/src/styles.css
+++ b/desktop-app/ui/src/styles.css
@@ -14174,6 +14174,14 @@ pre {
align-items: stretch;
}
+.da-gfs-delegation:not(.da-gfs-delegation--details) .da-gfs-delegation__composer {
+ grid-template-columns: minmax(0, 1fr);
+}
+
+.da-gfs-delegation__composer > .ui-dropdown-select {
+ min-width: 150px;
+}
+
.da-gfs-subject-picker,
.da-gfs-permission-dropdown {
position: relative;
@@ -15226,6 +15234,7 @@ pre {
.da-gfs-manage-dialog__title-row h3 {
min-width: 0;
+ white-space: normal;
}
.da-gfs-manage-dialog__title-edit {
@@ -15818,9 +15827,9 @@ pre {
gap: var(--space-2);
min-width: 0;
padding: var(--space-2);
- border: 1px solid var(--border-soft);
+ border: 0;
border-radius: var(--radius-md);
- background: var(--surface-soft);
+ background: transparent;
}
.da-gfs-grant-list__identity {
@@ -15852,6 +15861,28 @@ pre {
gap: var(--space-1);
}
+.da-gfs-grant-list__role.ui-control {
+ width: 112px;
+ min-height: 32px;
+ border-color: transparent;
+ background: transparent;
+ font-weight: var(--font-weight-medium);
+}
+
+.da-gfs-grant-list__role.ui-control:hover,
+.da-gfs-grant-list__role.ui-control:focus {
+ border-color: var(--control-border);
+ background: var(--control-bg-strong);
+}
+
+.da-gfs-grant-list__role-label {
+ min-width: 112px;
+ padding-inline: var(--space-2);
+ color: var(--text-muted);
+ font-size: var(--font-size-sm);
+ font-weight: var(--font-weight-medium);
+}
+
.da-gfs-grant-list__chips {
display: inline-flex;
flex-wrap: wrap;