发布

  • [OPIK-6977][OPIK-6976] [FE] Permissions follow-up: Agent Playground, Online Evaluation, Alerts, Prompt Library (#7259)

    frostbyte_neo 发布于 2026-07-03 12:23:41 +00:00

    • [OPIK-6977] [FE] Hide Agent Playground, Online Evaluation, and Alerts from Annotator role

    Add page guards and sidebar gating for three pages that should not be
    visible to users with the Annotator workspace role. Agent Playground
    uses a compound permission check requiring agent_playground_use,
    trace logging, and experiment creation permissions.

    • [OPIK-6976] [FE] Add prompt library permission gating

    Gate prompt library page, sidebar, edit buttons, and deploy-to-environment
    behind canViewPrompts and canEditPrompts permissions. Hide row actions
    menu when user has no edit/delete permissions.

    • [OPIK-6976] [BE] Add prompt permission annotations to Opik backend endpoints

    Add PROMPT_VIEW, PROMPT_CREATE, PROMPT_EDIT to WorkspaceUserPermission
    enum and annotate all PromptResource endpoints with @RequiredPermissions
    to enforce prompt permissions at the API level (UI + SDK).

    • Revision: Hide empty state create buttons for view-only users, fix lone separator
    • Hide "Create your first rule" on Online Evaluation empty state when
      user lacks update permission
    • Hide "Create your first experiment" on Experiments empty state when
      user lacks create permission
    • Only show dropdown separator between Edit and Delete when both are visible
    • Revision 2: Address QA feedback on prompt permission gating
    • Hide prompt tags add/remove for users without edit permission
      (PromptTagsList uses new readOnly prop on TagListRenderer)
    • Replace canAdd prop with readOnly on TagListRenderer — controls
      both add and delete consistently across all callsites
    • Hide load prompt button in Playground when user lacks view permission
      (both header and message actions)
    • Hide save button in Playground when user lacks create/edit permission
      (header save, message actions save)
    • Hide Improve button on prompt detail when user lacks edit permission
    • Add canViewPrompts to Agent Playground compound permission check
    • Gate Agent Runner save/unsaved-changes with canEditPrompts
    • Hide prompt tab in trace/span detail panel without view permission
    • Hide empty state create buttons for Online Evaluation and Experiments
    • Revision 3: Fix createPromptVersion/restorePromptVersion to use PROMPT_EDIT

    Creating a new version of an existing prompt is an edit operation, not
    a create. Changed BE annotations from PROMPT_CREATE to PROMPT_EDIT so
    the FE only needs canEditPrompts for version saves — no dual permission
    check needed.

    • Revision 4: Fix version save permissions and save dialog gating
    • Change createPromptVersion/restorePromptVersion BE annotations from
      PROMPT_CREATE to PROMPT_EDIT (creating a version is editing a prompt)
    • Show save button when user has edit OR create permission
    • Save dialog: only show toggle when user has both; default to "Save as
      new" when user lacks edit permission
    • Show unsaved changes indicator for chat prompts when user can save
    • Revision 5: Fix save button for edit-only users with no loaded prompt

    Only show save when the dialog can actually submit: no prompt loaded
    requires canCreatePrompts, prompt loaded allows either canEditPrompts
    or canCreatePrompts.

    下载附件