Skip to content

fix(wand): should not be able to use wand ui without write/admin perms - #2384

Merged
icecrasher321 merged 1 commit into
stagingfrom
fix/wand-ui-check
Dec 15, 2025
Merged

fix(wand): should not be able to use wand ui without write/admin perms#2384
icecrasher321 merged 1 commit into
stagingfrom
fix/wand-ui-check

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

Should not be able to use wand ui without write/admin perms.

Type of Change

  • Bug fix

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Dec 15, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentReviewUpdated (UTC)
docsSkippedSkippedDec 15, 2025 9:11pm

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Prevented users without write/admin permissions from accessing wand UI by passing the disabled prop to the wand rendering logic.

Key changes:

  • Added disabled parameter to the renderLabel function's wandState object
  • Passed isDisabled value (derived from !userPermissions.canEdit) to the wand rendering condition on line 213
  • Updated the wand UI visibility condition from isWandEnabled && !isPreview to isWandEnabled && !isPreview && !disabled

This ensures the wand icon and inline prompt input are hidden for users with read-only permissions, complementing the backend validation added in PR #2383.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward and follow the existing pattern used throughout the codebase for permission-based UI control. The disabled prop is already used consistently for all other sub-block inputs, and this change simply extends the same logic to the wand UI component. The implementation is minimal, focused, and aligns with the backend validation added in the previous PR fix(wand): validate session before allowing access to wand generation #2383.
  • No files require special attention

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/sub-block.tsx5/5Added disabled prop to wand UI rendering logic to prevent users without write/admin permissions from accessing wand features

Sequence Diagram

sequenceDiagram
participant User
participant Editor
participant SubBlock
participant renderLabel
participant WandUI
User->>Editor: Interacts with workflow editor
Editor->>Editor: Check userPermissions.canEdit
Editor->>SubBlock: Render with disabled={!userPermissions.canEdit}
SubBlock->>SubBlock: Compute isDisabled via useDependsOnGate
SubBlock->>renderLabel: Pass disabled: isDisabled in wandState
renderLabel->>renderLabel: Check isWandEnabled && !isPreview && !disabled
alt disabled = true (no write/admin perms)
renderLabel->>WandUI: Do not render wand icon/input
else disabled = false (has write/admin perms)
renderLabel->>WandUI: Render wand icon and inline prompt
User->>WandUI: Click wand icon or enter prompt
WandUI->>SubBlock: Trigger wand generation
end
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321
icecrasher321 merged commit 8d38c2f into stagingDec 15, 2025
10 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/wand-ui-check branch December 16, 2025 05:51
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@icecrasher321