Skip to content

improvement(permissions): fixed permissions and variables access patterns#539

Merged
waleedlatif1 merged 3 commits intostagingfrom
improvement/perms
Jun 25, 2025
Merged

improvement(permissions): fixed permissions and variables access patterns#539
waleedlatif1 merged 3 commits intostagingfrom
improvement/perms

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

@waleedlatif1 waleedlatif1 commented Jun 25, 2025

Description

fixed permissions and variables access patterns, we were still maintaining the old system to fetch workflow permissions via workspace member, but now we actually have permissions

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Performance improvement

How Has This Been Tested?

Tested to ensure permissions system still works properly.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally and in CI (bun run test)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I have updated version numbers as needed (if needed)
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Security Considerations:

  • My changes do not introduce any new security vulnerabilities
  • I have considered the security implications of my changes

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 25, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sim ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2025 3:22am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Skipped (Inspect) Jun 25, 2025 3:22am

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Major refactor of the permissions system, moving from workspace-member based permissions to a dedicated permissions system for workflows and variables, with improved caching and test coverage.

  • Implemented new permission utilities in apps/sim/app/api/workflows/[id]/route.ts with getUserEntityPermissions and hasAdminPermission for granular access control
  • Optimized workflow variable handling in apps/sim/app/w/[id]/workflow.tsx to prevent unnecessary resets during workflow switching
  • Added comprehensive test coverage in apps/sim/app/api/workflows/[id]/variables/route.test.ts for the new permissions system
  • Reduced cache time from 60s to 30s and implemented content-based ETags in variables API for better performance
  • Removed deprecated test-socket-integration.html as part of cleanup

7 files reviewed, 3 comments
Edit PR Review Bot Settings | Greptile

Comment thread apps/sim/app/api/workflows/[id]/route.test.ts
Comment thread apps/sim/app/api/workflows/[id]/route.test.ts
Comment thread apps/sim/app/api/workflows/[id]/variables/route.ts
@delve-auditor
Copy link
Copy Markdown

delve-auditor Bot commented Jun 25, 2025

No security or compliance issues detected. Reviewed everything up to 7cf46e7.

Security Overview
  • 🔎 Scanned files: 7 changed file(s)
Detected Code Changes
Change Type Relevant files
Enhancement ► route.test.ts
    Add tests for workflow and workflow variables APIs
► route.ts
    Optimize permissions handling and caching for variables
► variables.tsx
    Improve variable loading logic
► workflow.tsx
    Optimize variables reset handling
Other ► test-socket-integration.html
    Remove test file

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@waleedlatif1 waleedlatif1 merged commit d084ecd into staging Jun 25, 2025
4 checks passed
@waleedlatif1 waleedlatif1 deleted the improvement/perms branch June 28, 2025 04:46
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
…erns (simstudioai#539)

* fixed permissions and variables access patterns

* only fetch variables if we are actually switching worklfows

* fixed tests
Sign up for free to 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