-
Notifications
You must be signed in to change notification settings - Fork 174
Add permision check for benchmark panel #2108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,8 +1,10 @@ | ||||||
| import { cn, ResizableHandle, ResizablePanel } from '@openops/components/ui'; | ||||||
| import { Permission } from '@openops/shared'; | ||||||
| import { t } from 'i18next'; | ||||||
| import { useCallback, useEffect, useMemo, useRef } from 'react'; | ||||||
| import { ImperativePanelHandle } from 'react-resizable-panels'; | ||||||
|
|
||||||
| import { useAuthorization } from '@/app/common/hooks/authorization-hooks'; | ||||||
| import { useResizablePanelGroup } from '@/app/common/hooks/use-resizable-panel-group'; | ||||||
| import { RESIZABLE_PANEL_IDS } from '@/app/constants/layout'; | ||||||
| import AssistantUiChat from '@/app/features/ai/assistant/assistant-ui-chat'; | ||||||
|
|
@@ -32,6 +34,11 @@ const SecondaryLeftSidePanelContainer = ({ | |||||
| setIsSidebarMinimized: s.setIsSidebarMinimized, | ||||||
| })); | ||||||
|
|
||||||
| const { checkAccess } = useAuthorization(); | ||||||
| const hasBenchmarkAccess = | ||||||
| checkAccess(Permission.WRITE_FLOW) && | ||||||
| checkAccess(Permission.READ_APP_CONNECTION); | ||||||
|
||||||
| checkAccess(Permission.READ_APP_CONNECTION); | |
| checkAccess(Permission.WRITE_APP_CONNECTION); |
Copilot
AI
Mar 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When hasBenchmarkAccess is false but isBenchmarkWizardOpen is true, shouldShowBenchmark becomes false and the wizard is hidden, but the global store state remains "open". Since useOpenBenchmarkWizard can still set isBenchmarkWizardOpen(true) without checking permissions, this can leave the app in an inconsistent state where the benchmark wizard is logically open but invisible. Consider auto-closing (setIsBenchmarkWizardOpen(false)) when access is missing, or enforcing the permission check at the point where the wizard is opened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasBenchmarkAccessrelies oncheckAccess(...), butuseAuthorization().checkAccessis currently implemented asreturn true(packages/react-ui/src/app/common/hooks/authorization-hooks.ts:9-11). As a result, this change does not actually add a permission check and the benchmark panel will still always be shown whenisBenchmarkWizardOpenis true. Consider implementing real permission evaluation inuseAuthorization(or using an existing authorization source) so this gating is effective.