Skip to content

armgit / dify

Public Imported from GitHub
0

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.

fix(web): hide Open in Explore for SSO-restricted apps (#41518)

Xiyuan Chence801f444541
diff --git a/web/app/components/apps/__tests__/app-card.spec.tsx b/web/app/components/apps/__tests__/app-card.spec.tsx
index 46a56fb684e..adb020b86b7 100644
--- a/web/app/components/apps/__tests__/app-card.spec.tsx
+++ b/web/app/components/apps/__tests__/app-card.spec.tsx
@@ -1,5 +1,5 @@
import type { AppPartial } from '@dify/contracts/api/console/apps/types.gen'
-import { fireEvent, screen, waitFor } from '@testing-library/react'
+import { fireEvent, screen, waitFor, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import * as React from 'react'
import { STEP_BY_STEP_TOUR_TARGETS } from '@/app/components/step-by-step-tour/target-registry'
@@ -1291,6 +1291,21 @@ describe('AppCard', () => {
expect(screen.getByText('app.openInExplore')).toBeInTheDocument()
})
})
+
+ it('should hide open in explore for SSO-restricted apps', async () => {
+ mockWebappAuthEnabled = true
+ const user = userEvent.setup()
+ const ssoApp = createMockApp({ access_mode: AccessMode.EXTERNAL_MEMBERS })
+
+ render(<AppCard app={ssoApp} />)
+
+ await user.click(getOperationsTrigger())
+ const menu = await screen.findByRole('menu')
+
+ expect(
+ within(menu).queryByRole('menuitem', { name: 'app.openInExplore' }),
+ ).not.toBeInTheDocument()
+ })
})
describe('Workflow Export with Environment Variables', () => {
diff --git a/web/app/components/apps/app-card/interactions.tsx b/web/app/components/apps/app-card/interactions.tsx
index 137e04c0bdb..0bdb03c2101 100644
--- a/web/app/components/apps/app-card/interactions.tsx
+++ b/web/app/components/apps/app-card/interactions.tsx
@@ -55,6 +55,7 @@ import { useProviderContext } from '@/context/provider-context'
import { userProfileQueryOptions } from '@/features/account-profile/client'
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
import { useAsyncWindowOpen } from '@/hooks/use-async-window-open'
+import { AccessMode } from '@/models/access-control'
import dynamic from '@/next/dynamic'
import { useRouter } from '@/next/navigation'
import { useGetUserCanAccessApp } from '@/service/access-control/use-app-access-control'
@@ -136,6 +137,7 @@ function AppCardOperationsMenuItems({
const needsPublishBeforeExplore = requiresPublishedWorkflowInExplore(app) && !app.workflow?.id
const shouldShowOpenInExploreOption =
!app.has_draft_trigger &&
+ app.access_mode !== AccessMode.EXTERNAL_MEMBERS &&
(needsPublishBeforeExplore ||
!systemFeatures.webapp_auth.enabled ||
(!isGettingUserCanAccessApp && Boolean(userCanAccessApp?.result)))