Skip to content

Commit b0d15a1

Browse files
johnyrahulclaude
andcommitted
UN-2868 [FIX] Restrict tool modification to workflow owners only
Added ownership check to prevent non-owners from modifying workflow tools: - Added isWorkflowOwner() helper function to compare current user ID with workflow creator ID - Disabled "Change Prompt Studio project" button for non-owners - Disabled "Configure Settings" button for non-owners - Handles type differences between user IDs (integer vs string) by converting both to strings This ensures that only workflow owners can change or configure the Prompt Studio projects in shared workflows. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ac70278 commit b0d15a1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

frontend/src/components/agency/agency/Agency.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,15 @@ function Agency() {
390390
return tool?.name || toolId;
391391
};
392392

393+
// Check if current user is the workflow owner
394+
const isWorkflowOwner = () => {
395+
if (!details?.created_by || !sessionDetails?.id) {
396+
return false;
397+
}
398+
// Convert both to strings for comparison to handle type differences
399+
return String(details.created_by) === String(sessionDetails.id);
400+
};
401+
393402
// Initialize selected tool from existing tool instances on page load
394403
const initializeSelectedTool = () => {
395404
if (details?.tool_instances?.length > 0) {
@@ -1147,6 +1156,7 @@ function Agency() {
11471156
type="link"
11481157
onClick={() => setShowToolSelectionSidebar(true)}
11491158
size="small"
1159+
disabled={!isWorkflowOwner()}
11501160
>
11511161
Change Prompt Studio project
11521162
</Button>
@@ -1164,7 +1174,7 @@ function Agency() {
11641174
<Button
11651175
type="primary"
11661176
onClick={() => setShowSidebar(!showSidebar)}
1167-
disabled={!selectedTool}
1177+
disabled={!selectedTool || !isWorkflowOwner()}
11681178
>
11691179
Configure Settings
11701180
</Button>

0 commit comments

Comments
 (0)