Skip to content

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

TypeScript

feat(desktop): show inherited access in folder manage dialogs

M26f1b9809c82
diff --git a/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts b/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
index 63c77c4eb..bbd933ce4 100644
--- a/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
+++ b/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
@@ -9,6 +9,7 @@ import {
useQueryClient,
} from '@tanstack/react-query'
import { GFS_BREADCRUMB_MAX_DEPTH } from '@constants/gfsBrowser'
+import { applyMoveConvergence } from '@lib/gfsEntityChangeState'
import {
describeGfsReadError,
isRateLimited,
@@ -17,7 +18,6 @@ import {
} from '@lib/gfsGrantErrors'
import type { GfsGrantListItem, GfsShareListItem } from '@/gfs/delegation.types'
import { deriveGfsInheritedAccess } from '@/gfs/inheritedAccess'
-import { applyMoveConvergence } from '@lib/gfsEntityChangeState'
import { desktopQueryKeys } from './queryKeys'
/**
@@ -535,11 +535,11 @@ export function useGfsBrowserController(options: GfsBrowserControllerOptions = {
DRIVE
),
queryFn: () => deriveGfsInheritedAccess(current!.resourceId, DRIVE),
+ // FILES AND FOLDERS: a folder Manage dialog must show the identities its
+ // ancestors grant (the walk is kind-agnostic — it resolves the target and
+ // follows parent resource ids), so only the dialog + session gates apply.
enabled:
- Boolean(sessionScope) &&
- current?.kind === 'file' &&
- grantsListEnabled &&
- accessState === 'active',
+ Boolean(sessionScope) && Boolean(current) && grantsListEnabled && accessState === 'active',
})
const refreshShares = useCallback(async () => {
const resourceId = current?.resourceId
@@ -1396,7 +1396,13 @@ export function useGfsBrowserController(options: GfsBrowserControllerOptions = {
newName?: string,
oldParentId?: string | null
) =>
- moveResourceMutation.mutateAsync({ resourceId, destinationId, ifMatch, newName, oldParentId }),
+ moveResourceMutation.mutateAsync({
+ resourceId,
+ destinationId,
+ ifMatch,
+ newName,
+ oldParentId,
+ }),
deleteResource: (resourceId: string, ifMatch?: number) =>
deleteResourceMutation.mutateAsync({ resourceId, ifMatch }),
mutating:
diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsx
index 720924538..881d6aaae 100644
--- a/desktop-app/ui/src/pages/FilesPage.tsx
+++ b/desktop-app/ui/src/pages/FilesPage.tsx
@@ -511,9 +511,9 @@ export function FilesPage({
const currentIsFile = current?.kind === 'file'
// A total inherited-derivation failure becomes a quiet notice in the Share
// dialog: an empty derived list alone would silently read as "no one else
- // has access" (R1-M3). Per-ancestor best-effort skipping stays silent.
- const inheritedAccessNotice =
- currentIsFile && ctrl.inheritedAccessError ? INHERITED_DERIVATION_NOTICE : null
+ // has access" (R1-M3). Applies to FILES AND FOLDERS; per-ancestor
+ // best-effort skipping stays silent.
+ const inheritedAccessNotice = ctrl.inheritedAccessError ? INHERITED_DERIVATION_NOTICE : null
const currentPreviewAvailable = currentIsFile && isGfsPreviewFile(current?.name ?? '')
const droppedUploadRestriction = useMemo(() => {
if (!current) {
@@ -2299,7 +2299,9 @@ export function FilesPage({
loading={
ctrl.loadingGrants || ctrl.loadingShares || ctrl.loadingInheritedAccess
}
- mergeInherited={currentIsFile}
+ // FILES AND FOLDERS merge inherited rows (the reported
+ // folder bug); the dialog itself only opens with a target.
+ mergeInherited
onChangeInheritedRole={handleInheritedRoleChange}
onChangeRole={affordances?.canDelegate ? handleAccessRoleChange : undefined}
onRemoveInherited={handleInheritedRemove}
diff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
index ee87b817a..c457ad2a8 100644
--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
@@ -1860,6 +1860,50 @@ describe('FilesPage', () => {
).toContain('Editor')
})
+ it('shows inherited members in a FOLDER manage dialog too', async () => {
+ installInheritedDirectoryMocks()
+ hookMock.useGfsBrowserController.mockReturnValue(
+ inheritedFileController({
+ current: {
+ resourceId: 'folder-1',
+ gfsUri: 'gfs://main/folder-1',
+ name: 'Team folder',
+ kind: 'directory' as const,
+ version: 2,
+ },
+ grants: [],
+ inheritedAccess: [
+ {
+ subject: { type: 'user', id: 'user-2' },
+ permissions: ['read', 'write'],
+ inheritedFrom: ['main'],
+ sources: [
+ {
+ resourceId: 'root-1',
+ name: 'main',
+ permissions: ['read', 'write'],
+ grantId: 'root-grant-1',
+ shareIds: [],
+ },
+ ],
+ },
+ ],
+ })
+ )
+
+ renderFilesPage()
+ await openManageDialog('Team folder')
+
+ const manageDialog = await screen.findByRole('dialog', { name: 'Share folder Team folder' })
+ // The inherited member granted by the drive root renders as a normal
+ // toggleable row — the reported "no one has access" folder bug.
+ const row = await within(manageDialog).findByTestId('gfs-access-row-inherited-user:user-2')
+ expect(within(row).getByText('Test Two')).toBeTruthy()
+ expect(
+ within(row).getByRole('button', { name: 'Access role for Test Two' }).textContent
+ ).toContain('Editor')
+ })
+
it('confirms an inherited role change against the parent folder and applies it there', async () => {
installInheritedDirectoryMocks()
const parentGrant = (window.clerum.gfs as unknown as { grant: ReturnType<typeof vi.fn> }).grant