Skip to content

[OPIK-4721] Use playground permission#5922

Open
anastasiapyzhik wants to merge 8 commits intomainfrom
nastassia/OPIK-4721/use-playground-permission
Open

[OPIK-4721] Use playground permission#5922
anastasiapyzhik wants to merge 8 commits intomainfrom
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

@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
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.

1 participant