Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: debug plugin permission setting not work (#38197)
非法操作4303103304a3
diff --git a/web/app/components/plugins/plugin-page/__tests__/use-reference-setting.spec.ts b/web/app/components/plugins/plugin-page/__tests__/use-reference-setting.spec.tsindex 2ab99dfe878..9d5958e2718 100644--- a/web/app/components/plugins/plugin-page/__tests__/use-reference-setting.spec.ts+++ b/web/app/components/plugins/plugin-page/__tests__/use-reference-setting.spec.ts@@ -128,7 +128,7 @@ describe('useReferenceSetting Hook', () => {expect(result.current.canDebugger).toBe(true)})- it('should ignore legacy admin permission for managers without plugin keys', () => {+ it('should allow debug for managers with legacy admin permission when RBAC is disabled', () => {vi.mocked(useAppContext).mockReturnValue({isCurrentWorkspaceManager: true,isCurrentWorkspaceOwner: false,@@ -146,10 +146,10 @@ describe('useReferenceSetting Hook', () => {const { result } = renderHook(() => useReferenceSetting(PluginCategoryEnum.tool))expect(result.current.canManagement).toBe(false)- expect(result.current.canDebugger).toBe(false)+ expect(result.current.canDebugger).toBe(true)})- it('should ignore legacy admin permission for owners without plugin keys', () => {+ it('should allow debug for owners with legacy admin permission when RBAC is disabled', () => {vi.mocked(useAppContext).mockReturnValue({isCurrentWorkspaceManager: false,isCurrentWorkspaceOwner: true,@@ -167,7 +167,30 @@ describe('useReferenceSetting Hook', () => {const { result } = renderHook(() => useReferenceSetting(PluginCategoryEnum.tool))expect(result.current.canManagement).toBe(false)- expect(result.current.canDebugger).toBe(false)+ expect(result.current.canDebugger).toBe(true)+ })++ it('should allow debug for normal users when legacy debug permission is everyone and RBAC is disabled', () => {+ vi.mocked(useAppContext).mockReturnValue({+ isCurrentWorkspaceManager: false,+ isCurrentWorkspaceOwner: false,+ langGeniusVersionInfo: { current_version: '1.0.0', latest_version: '', version: '' },+ workspacePermissionKeys: ['plugin.install'],+ } as ReturnType<typeof useAppContext>)++ vi.mocked(usePluginPermissionSettings).mockReturnValue({+ data: {+ install_permission: PermissionType.everyone,+ debug_permission: PermissionType.everyone,+ },+ } as ReturnType<typeof usePluginPermissionSettings>)++ const { result } = renderHook(() => useReferenceSetting(PluginCategoryEnum.tool), {+ systemFeatures: { rbac_enabled: false },+ })++ expect(result.current.canDebugPlugin).toBe(true)+ expect(result.current.canDebugger).toBe(true)})it('should use plugin keys even when legacy admin permission is configured and RBAC is enabled', () => {diff --git a/web/app/components/plugins/plugin-page/use-reference-setting.ts b/web/app/components/plugins/plugin-page/use-reference-setting.tsindex 20c306658fc..b2bce30f75c 100644--- a/web/app/components/plugins/plugin-page/use-reference-setting.ts+++ b/web/app/components/plugins/plugin-page/use-reference-setting.ts@@ -52,7 +52,9 @@ export const usePluginSettingsAccess = () => {const canInstallPlugin = hasPermission(workspacePermissionKeys, 'plugin.install') && legacyCanInstallPluginconst canUpdatePlugin = hasPermission(workspacePermissionKeys, 'plugin.install') && legacyCanInstallPluginconst canDeletePlugin = hasPermission(workspacePermissionKeys, 'plugin.delete') && legacyCanInstallPlugin- const canDebugPlugin = hasPermission(workspacePermissionKeys, 'plugin.debug') && legacyCanDebugPlugin+ const canDebugPlugin = rbacEnabled+ ? hasPermission(workspacePermissionKeys, 'plugin.debug')+ : legacyCanDebugPluginreturn {permission: permissions,