Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frontend/src/components/AgentSidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface Props {
workspaceActivities: WorkspaceActivity[];
workspaceLiveDraft?: WorkspaceLiveDraft | null;
workspaceLocked?: boolean;
canManageWorkspace?: boolean;
canManageEnterpriseInfo?: boolean;
visible: boolean;
onToggle: () => void;
Expand Down Expand Up @@ -55,6 +56,7 @@ export default function AgentSidePanel({
workspaceActivities,
workspaceLiveDraft,
workspaceLocked = false,
canManageWorkspace = false,
canManageEnterpriseInfo = false,
visible,
onToggle,
Expand Down Expand Up @@ -227,6 +229,7 @@ export default function AgentSidePanel({
activities={workspaceActivities}
liveDraft={workspaceLiveDraft}
locked={workspaceLocked}
canManageWorkspace={canManageWorkspace}
canManageEnterpriseInfo={canManageEnterpriseInfo}
onSelectPath={onWorkspaceSelectPath}
onToggleLock={onWorkspaceToggleLock}
Expand Down
62 changes: 35 additions & 27 deletions frontend/src/components/WorkspaceOperationPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ interface Props {
activities: WorkspaceActivity[];
liveDraft?: WorkspaceLiveDraft | null;
locked?: boolean;
canManageWorkspace?: boolean;
canManageEnterpriseInfo?: boolean;
onSelectPath: (path: string) => void;
onToggleLock?: () => void;
Expand Down Expand Up @@ -393,6 +394,7 @@ export default function WorkspaceOperationPanel({
activities,
liveDraft,
locked = false,
canManageWorkspace = false,
canManageEnterpriseInfo = false,
onSelectPath,
onToggleLock,
Expand Down Expand Up @@ -437,7 +439,9 @@ export default function WorkspaceOperationPanel({
const manualTreeScopeRef = useRef<TreeScope | null>(null);

const ext = activePath ? extOf(activePath) : '';
const canModifyPath = (path?: string | null) => !isEnterprisePath(path) || canManageEnterpriseInfo;
const canModifyPath = (path?: string | null) => (
isEnterprisePath(path) ? canManageEnterpriseInfo : canManageWorkspace
);
Comment on lines +442 to +444

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve workspace edits for use-level users

For agents where the current user has access_level: "use", this makes canModifyPath('workspace/...') false, which also suppresses the side-panel edit button via canEdit and blocks create/upload actions. The rest of the workspace UI still enables upload, newFile, newFolder, and edit for these users while gating only delete on canManage (AgentDetailPage.tsx:5792), and the write endpoint only requires check_agent_access (backend/app/api/files.py:604), so this commit removes an allowed workflow from the live side panel rather than just hiding unauthorized deletes.

Useful? React with 👍 / 👎.

const isWritableTreeDir = (path?: string | null) => isWritableDir(path) && canModifyPath(path);
const canEdit = !!activePath && EDITABLE_EXTS.has(ext) && canModifyPath(activePath);
const isHtml = ext === '.html' || ext === '.htm';
Expand Down Expand Up @@ -1237,32 +1241,36 @@ export default function WorkspaceOperationPanel({
</svg>
</a>
)}
<button
className="workspace-op-tree-action-btn"
type="button"
onClick={handleUploadClick}
title={`Upload into ${treeTargetDir}`}
aria-label={`Upload into ${treeTargetDir}`}
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M12 16V5" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" />
<path d="M8 9l4-4 4 4" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" strokeLinejoin="round" />
<path d="M5 19h14" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" />
</svg>
</button>
<button
className="workspace-op-tree-action-btn"
type="button"
onClick={handleCreateFolder}
title={`Create folder in ${treeTargetDir}`}
aria-label={`Create folder in ${treeTargetDir}`}
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M4 8.5A2.5 2.5 0 016.5 6H10l1.4 1.6H17.5A2.5 2.5 0 0120 10.1v6.4A2.5 2.5 0 0117.5 19h-11A2.5 2.5 0 014 16.5v-8Z" stroke="currentColor" strokeWidth="1.8" strokeLinejoin="round" />
<path d="M12 10.5v5" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" />
<path d="M9.5 13h5" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" />
</svg>
</button>
{canManageWorkspace && (
<>
<button
className="workspace-op-tree-action-btn"
type="button"
onClick={handleUploadClick}
title={`Upload into ${treeTargetDir}`}
aria-label={`Upload into ${treeTargetDir}`}
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M12 16V5" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" />
<path d="M8 9l4-4 4 4" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" strokeLinejoin="round" />
<path d="M5 19h14" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" />
</svg>
</button>
<button
className="workspace-op-tree-action-btn"
type="button"
onClick={handleCreateFolder}
title={`Create folder in ${treeTargetDir}`}
aria-label={`Create folder in ${treeTargetDir}`}
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M4 8.5A2.5 2.5 0 016.5 6H10l1.4 1.6H17.5A2.5 2.5 0 0120 10.1v6.4A2.5 2.5 0 0117.5 19h-11A2.5 2.5 0 014 16.5v-8Z" stroke="currentColor" strokeWidth="1.8" strokeLinejoin="round" />
<path d="M12 10.5v5" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" />
<path d="M9.5 13h5" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" />
</svg>
</button>
</>
)}
</div>
);

Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/agent-detail/AgentDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6562,6 +6562,7 @@ export default function AgentDetailPage() {
onTabChange={setSidePanelTab}
awareContent={renderAwarePreview()}
workspaceLocked={workspacePreviewLocked}
canManageWorkspace={canManage}
onWorkspaceSelectPath={handleWorkspaceSelectPath}
onWorkspaceToggleLock={handleWorkspaceToggleLock}
onWorkspaceEditingChange={handleWorkspaceEditingChange}
Expand Down