Skip to content

[OPIK-4721] Use playground permission#5922

Merged
anastasiapyzhik merged 9 commits into
mainfrom
nastassia/OPIK-4721/use-playground-permission
Apr 13, 2026
Merged

[OPIK-4721] Use playground permission#5922
anastasiapyzhik merged 9 commits into
mainfrom
nastassia/OPIK-4721/use-playground-permission

Conversation

@anastasiapyzhik
Copy link
Copy Markdown
Contributor

@anastasiapyzhik anastasiapyzhik commented Mar 27, 2026

Details

Add playground_use permission to the frontend and hide the Playground entirely when the user lacks this permission.

Permission infrastructure:

  • Add PLAYGROUND_USE to ManagementPermissionsNames enum
  • Add canUsePlayground to the Permissions interface, defaults, hook, and provider

Route guards (v1 & v2):

  • Create PlaygroundPageGuard component using NoAccessPageGuard with custom message: "You don't have permissions to use playground in this workspace."
  • Wire guard into both routers with child index route pattern

Sidebar navigation (v1 & v2):

  • Conditionally include the "Playground" menu item based on canUsePlayground

Prompts page (v1 & v2):

  • Hide "Try in the Playground" and "Improve prompt" buttons in PromptTab when user lacks permission

Evaluation suites (v1 & v2):

  • Hide "Open in Playground" dropdown menu item in UseEvaluationSuiteDropdown
  • Hide the entire dropdown trigger when neither canUsePlayground nor canCreateExperiments is available (prevents empty dropdown)

Trace details (v1 & v2):

  • Hide "Use in Playground" button in PromptsTab when user lacks permission

Change checklist

  • Permission enum added to ManagementPermissionsNames
  • canUsePlayground wired through useUserPermissionPermissionsProviderPermissions interface
  • PlaygroundPageGuard created for both v1 and v2
  • Sidebar playground item conditionally rendered
  • All playground entry-point buttons guarded
  • Empty dropdown edge case handled in UseEvaluationSuiteDropdown
  • Both v1 and v2 updated consistently

Testing

  1. With permission: Verify all playground flows work as before (sidebar visible, route accessible, all buttons present)
  2. Without permission:
    • Sidebar: "Playground" item should be hidden
    • Direct URL navigation: Should show 403 page with "You don't have permissions to use playground in this workspace."
    • Prompt library: "Try in the Playground" and "Improve prompt" buttons should be hidden
    • Evaluation suites: "Open in Playground" dropdown item should be hidden; entire dropdown hidden if experiment creation is also denied
    • Trace details: "Use in Playground" button should be hidden
  3. OSS/self-hosted: Default true — no behavior change
  4. Admin users: Playground always accessible

Issues

OPIK-4721

Documentation

N/A

Comment thread apps/opik-frontend/src/v1/layout/PlaygroundPageGuard/index.tsx
Comment thread apps/opik-frontend/src/plugins/comet/useUserPermission.ts
Comment thread apps/opik-frontend/src/v1/pages/PromptPage/PromptTab/PromptTab.tsx
@anastasiapyzhik anastasiapyzhik marked this pull request as ready for review March 27, 2026 15:30
@anastasiapyzhik anastasiapyzhik requested a review from a team as a code owner March 27, 2026 15:30
@anastasiapyzhik anastasiapyzhik merged commit 4da187d into main Apr 13, 2026
13 checks passed
@anastasiapyzhik anastasiapyzhik deleted the nastassia/OPIK-4721/use-playground-permission branch April 13, 2026 11:15
thiagohora pushed a commit that referenced this pull request Apr 13, 2026
* [OPIK-4721] add new permission

* [OPIK-4721] add page guards

* [OPIK-4721] hide playground in sidebar menu

* [OPIK-4721] hide playground CTAs

* [OPIK-4721] guard confirmation dialog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants