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(web): align Web App launch permissions (#42574)
Wu Tianwei2590d9076983
diff --git a/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx b/web/app/components/app/access-point/__tests__/web-app-card.spec.tsxindex 402b94c5476..6797c7ac99b 100644--- a/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx+++ b/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx@@ -14,6 +14,7 @@ import { basePath } from '@/utils/var'import { WebAppAccessPointCard } from '../built-in-access-points/web-app-card'const mocks = vi.hoisted(() => ({+ getUserCanAccess: vi.fn<() => Promise<{ result: boolean }>>(),siteEnable: vi.fn(),resetSiteAccessToken: vi.fn().mockResolvedValue({}),}))@@ -52,9 +53,24 @@ vi.mock('@/service/console', () => ({},}))-vi.mock('@/service/access-control/use-app-access-control', () => ({- useAppWhiteListSubjects: () => ({- data: undefined,+vi.mock('@/service/access-control/use-app-access-control', async (importOriginal) => {+ const actual =+ await importOriginal<typeof import('@/service/access-control/use-app-access-control')>()+ return {+ ...actual,+ useAppWhiteListSubjects: () => ({+ data: undefined,+ }),+ }+})++vi.mock('@/service/share', () => ({+ getUserCanAccess: mocks.getUserCanAccess,+}))++vi.mock('@/features/system-features/client', () => ({+ systemFeaturesQueryOptions: () => ({+ queryKey: ['system-features'],}),}))@@ -63,7 +79,11 @@ vi.mock('@/app/components/base/app-icon', () => ({}))vi.mock('@/app/components/app/app-access-control', () => ({- default: () => null,+ default: ({ onConfirm }: { onConfirm: () => Promise<void> }) => (+ <button type="button" onClick={() => void onConfirm()}>+ Save access control+ </button>+ ),}))vi.mock('@/app/components/app/overview/customize', () => ({@@ -112,15 +132,22 @@ function renderCard(availability: 'available' | 'loading' | 'unavailable' = 'available',workflow?: PublishedWorkflow,{+ accessMode = AccessMode.PUBLIC,canManageAccessPoint = true,onRefreshApp = vi.fn().mockResolvedValue(undefined),+ showAccessControl = true,}: {+ accessMode?: AccessModecanManageAccessPoint?: booleanonRefreshApp?: () => Promise<void>+ showAccessControl?: boolean} = {},) {- useAppStore.setState({ appDetail: createAppInfo(mode) })+ useAppStore.setState({ appDetail: { ...createAppInfo(mode), access_mode: accessMode } })const queryClient = createTestQueryClient()+ queryClient.setQueryData(['system-features'], {+ webapp_auth: { enabled: showAccessControl },+ })return render(<QueryClientProvider client={queryClient}>@@ -128,6 +155,7 @@ function renderCard(availability={availability}canManageAccessPoint={canManageAccessPoint}onRefreshApp={onRefreshApp}+ showAccessControl={showAccessControl}workflow={workflow}/></QueryClientProvider>,@@ -138,11 +166,13 @@ function StoreConnectedWebAppCard({availability,canManageAccessPoint,onRefreshApp,+ showAccessControl,workflow,}: {availability: 'available' | 'loading' | 'unavailable'canManageAccessPoint: booleanonRefreshApp: () => Promise<void>+ showAccessControl: booleanworkflow?: PublishedWorkflow}) {const appInfo = useAppStore((state) => state.appDetail)@@ -155,7 +185,7 @@ function StoreConnectedWebAppCard({canDeploycanManageAccesscanManageAccessPoint={canManageAccessPoint}- showAccessControl+ showAccessControl={showAccessControl}onRefreshApp={onRefreshApp}onSaveSiteConfig={vi.fn().mockResolvedValue(undefined)}workflow={workflow}@@ -218,6 +248,7 @@ const workflowWithHiddenInput: NonNullable<PublishedWorkflow> = {describe('WebAppAccessPointCard', () => {beforeEach(() => {vi.clearAllMocks()+ mocks.getUserCanAccess.mockResolvedValue({ result: true })mocks.siteEnable.mockResolvedValue({enable_site: true,})@@ -237,6 +268,91 @@ describe('WebAppAccessPointCard', () => {).toBeEnabled()})+ it('disables Open and explains when the user cannot access the Web App', async () => {+ const user = userEvent.setup()+ mocks.getUserCanAccess.mockResolvedValue({ result: false })+ renderCard(AppModeEnum.WORKFLOW, 'available', undefined, {+ accessMode: AccessMode.SPECIFIC_GROUPS_MEMBERS,+ })++ const openButton = screen.getByRole('button', { name: /studio\.accessPoint\.open/ })+ await user.hover(openButton)++ expect(await screen.findByText('app.noAccessPermission')).toBeVisible()+ expect(openButton).toHaveAttribute('aria-disabled', 'true')+ expect(screen.getByRole('button', { name: /settings\.settings/ })).toBeEnabled()+ expect(+ screen.getByRole('button', { name: /accessControlDialog\.accessItems\.specific/ }),+ ).toBeEnabled()+ expect(+ screen.queryByRole('link', { name: /studio\.accessPoint\.open/ }),+ ).not.toBeInTheDocument()+ })++ it('keeps Open disabled until access is granted', async () => {+ const permission = createDeferredPromise<{ result: boolean }>()+ mocks.getUserCanAccess.mockReturnValueOnce(permission.promise)+ renderCard(AppModeEnum.WORKFLOW)++ expect(screen.getByRole('button', { name: /studio\.accessPoint\.open/ })).toHaveAttribute(+ 'aria-disabled',+ 'true',+ )++ permission.resolve({ result: true })++ expect(await screen.findByRole('link', { name: /studio\.accessPoint\.open/ })).toHaveAttribute(+ 'href',+ `https://site.example.test${basePath}/workflow/site-code`,+ )+ })++ it('allows opening external-member Web Apps independently of platform access', () => {+ mocks.getUserCanAccess.mockResolvedValue({ result: false })+ renderCard(AppModeEnum.WORKFLOW, 'available', undefined, {+ accessMode: AccessMode.EXTERNAL_MEMBERS,+ })++ expect(screen.getByRole('link', { name: /studio\.accessPoint\.open/ })).toHaveAttribute(+ 'href',+ `https://site.example.test${basePath}/workflow/site-code`,+ )+ })++ it('allows opening Web Apps without querying permissions when access control is disabled', () => {+ renderCard(AppModeEnum.CHAT, 'available', undefined, { showAccessControl: false })++ expect(screen.getByRole('link', { name: /studio\.accessPoint\.open/ })).toHaveAttribute(+ 'href',+ `https://site.example.test${basePath}/chat/site-code`,+ )+ expect(mocks.getUserCanAccess).not.toHaveBeenCalled()+ })++ it('updates Open after saving Web App access permissions', async () => {+ const user = userEvent.setup()+ mocks.getUserCanAccess.mockResolvedValue({ result: false })+ renderCard(AppModeEnum.CHAT, 'available', undefined, {+ accessMode: AccessMode.SPECIFIC_GROUPS_MEMBERS,+ })++ await user.click(+ screen.getByRole('button', { name: /accessControlDialog\.accessItems\.specific/ }),+ )+ expect(screen.getByRole('button', { name: /studio\.accessPoint\.open/ })).toHaveAttribute(+ 'aria-disabled',+ 'true',+ )++ mocks.getUserCanAccess.mockResolvedValue({ result: true })+ await user.click(screen.getByRole('button', { name: 'Save access control' }))++ expect(await screen.findByRole('link', { name: /studio\.accessPoint\.open/ })).toHaveAttribute(+ 'href',+ `https://site.example.test${basePath}/chat/site-code`,+ )+ })+it.each([AppModeEnum.WORKFLOW, AppModeEnum.COMPLETION])('does not offer Embed into site for %s apps',(mode) => {@@ -335,6 +451,27 @@ describe('WebAppAccessPointCard', () => {})})+ it('allows configuring workflow inputs but prevents launching without Web App access', async () => {+ const user = userEvent.setup()+ const openSpy = vi.spyOn(window, 'open').mockImplementation(() => null)+ mocks.getUserCanAccess.mockResolvedValue({ result: false })+ renderCard(AppModeEnum.WORKFLOW, 'available', workflowWithHiddenInput, {+ accessMode: AccessMode.SPECIFIC_GROUPS_MEMBERS,+ })++ const configButton = screen.getByRole('button', { name: /operation\.config/ })+ expect(configButton).toBeEnabled()+ await user.click(configButton)+ await user.type(screen.getByLabelText('Secret'), 'top-secret')++ const launchButton = screen.getByRole('button', { name: /overview\.appInfo\.launch/ })+ expect(launchButton).toBeDisabled()+ await user.click(launchButton)+ await user.keyboard('{Enter}')++ expect(openSpy).not.toHaveBeenCalled()+ })+it('shows loading without reporting an environment failure', () => {renderCard(AppModeEnum.WORKFLOW, 'loading')@@ -393,7 +530,7 @@ describe('WebAppAccessPointCard', () => {expect(toast.success).not.toHaveBeenCalled()})- it('disables Web App management actions without Access Point management', () => {+ it('disables Web App management actions without Access Point management', async () => {renderCard(AppModeEnum.CHAT, 'available', undefined, { canManageAccessPoint: false })expect(screen.getByRole('switch')).toHaveAttribute('aria-disabled', 'true')@@ -401,7 +538,10 @@ describe('WebAppAccessPointCard', () => {expect(screen.getByRole('button', { name: /customize\.entry/ })).toBeDisabled()expect(screen.getByRole('button', { name: /settings\.settings/ })).toBeDisabled()expect(screen.getByRole('button', { name: /regenerate/ })).toBeDisabled()- expect(screen.getByRole('link', { name: /studio\.accessPoint\.open/ })).toBeEnabled()+ expect(await screen.findByRole('link', { name: /studio\.accessPoint\.open/ })).toHaveAttribute(+ 'href',+ `https://site.example.test${basePath}/chat/site-code`,+ )expect(screen.getByRole('button', { name: /accessControlDialog\.accessItems\.anyone/ }),).toBeEnabled()diff --git a/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx b/web/app/components/app/access-point/built-in-access-points/web-app-card.tsxindex 4b8d353990c..69a62ec0dc5 100644--- a/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx+++ b/web/app/components/app/access-point/built-in-access-points/web-app-card.tsx@@ -29,7 +29,10 @@ import { AccessPointUrl } from '@/app/components/base/access-point/url'import AppIcon from '@/app/components/base/app-icon'import { toast } from '@/app/notifications'import { AccessMode } from '@/models/access-control'-import { useAppWhiteListSubjects } from '@/service/access-control/use-app-access-control'+import {+ useAppWhiteListSubjects,+ useGetUserCanAccessApp,+} from '@/service/access-control/use-app-access-control'import { consoleQuery } from '@/service/console'import { AppModeEnum } from '@/types/app'import { useAccessPointStatusLabel } from '../shared/use-access-point-status-label'@@ -141,6 +144,14 @@ export function WebAppAccessPointCard({!accessSubjects ||appInfo.access_mode !== AccessMode.SPECIFIC_GROUPS_MEMBERS ||Boolean(accessSubjects?.groups?.length || accessSubjects?.members?.length)+ const { data: userCanAccessApp, refetch: refetchUserCanAccessApp } = useGetUserCanAccessApp({+ appId: appInfo.id,+ enabled: showAccessControl,+ })+ const noAccessPermission =+ showAccessControl &&+ appInfo.access_mode !== AccessMode.EXTERNAL_MEMBERS &&+ !userCanAccessApp?.resultconst handleRegenerate = () => {if (!canManageAccessPoint || resetSiteAccessToken.isPending) return@@ -246,7 +257,10 @@ export function WebAppAccessPointCard({showQrCodeshowRegenerateopenLabel={t(($) => $['studio.accessPoint.open'], { ns: 'deployments' })}- openUrl={appInfo.enable_site && !toggleSiteMutation.isPending ? webAppUrl : undefined}+ openDisabledReason={+ noAccessPermission ? t(($) => $.noAccessPermission, { ns: 'app' }) : undefined+ }+ openUrl={actionsAvailable && !noAccessPermission ? webAppUrl : undefined}regenerateLabel={t(($) => $['overview.appInfo.regenerate'], {ns: 'appOverview',})}@@ -298,13 +312,14 @@ export function WebAppAccessPointCard({app={appInfo}onClose={() => setShowAccess(false)}onConfirm={async () => {- await onRefreshApp()+ await Promise.all([onRefreshApp(), refetchUserCanAccessApp()])setShowAccess(false)}}/>)}<WorkflowLaunchDialoghiddenVariables={hiddenLaunchVariables}+ launchDisabled={noAccessPermission}open={showWorkflowLaunch}targetUrl={webAppUrl}onOpenChange={setShowWorkflowLaunch}diff --git a/web/app/components/app/overview/workflow-launch-dialog/index.tsx b/web/app/components/app/overview/workflow-launch-dialog/index.tsxindex bfc7efccd8e..016fdd1868a 100644--- a/web/app/components/app/overview/workflow-launch-dialog/index.tsx+++ b/web/app/components/app/overview/workflow-launch-dialog/index.tsx@@ -15,11 +15,17 @@ import WorkflowHiddenInputFields from '../workflow-hidden-input-fields'type WorkflowLaunchFormProps = {hiddenVariables: WorkflowHiddenStartVariable[]+ launchDisabled: booleantargetUrl: stringonClose: () => void}-function WorkflowLaunchForm({ hiddenVariables, targetUrl, onClose }: WorkflowLaunchFormProps) {+function WorkflowLaunchForm({+ hiddenVariables,+ launchDisabled,+ targetUrl,+ onClose,+}: WorkflowLaunchFormProps) {const { t } = useTranslation()const [values, setValues] = useState<Record<string, WorkflowLaunchInputValue>>(() =>createWorkflowLaunchInitialValues(hiddenVariables),@@ -34,6 +40,8 @@ function WorkflowLaunchForm({ hiddenVariables, targetUrl, onClose }: WorkflowLauasync function handleSubmit(event: FormEvent<HTMLFormElement>) {event.preventDefault()+ if (launchDisabled) return+const launchUrl = await buildWorkflowLaunchUrl({accessibleUrl: targetUrl,variables: hiddenVariables,@@ -55,7 +63,7 @@ function WorkflowLaunchForm({ hiddenVariables, targetUrl, onClose }: WorkflowLau</div><div className="flex items-center justify-end gap-2 border-t-[0.5px] border-divider-subtle px-6 py-4"><Button onClick={onClose}>{t(($) => $['operation.cancel'], { ns: 'common' })}</Button>- <Button type="submit" variant="primary">+ <Button type="submit" variant="primary" disabled={launchDisabled}>{t(($) => $['overview.appInfo.launch'], { ns: 'appOverview' })}</Button></div>@@ -65,6 +73,7 @@ function WorkflowLaunchForm({ hiddenVariables, targetUrl, onClose }: WorkflowLautype WorkflowLaunchDialogProps = {hiddenVariables: WorkflowHiddenStartVariable[]+ launchDisabled?: booleanopen: booleantargetUrl: stringonOpenChange: (open: boolean) => void@@ -72,6 +81,7 @@ type WorkflowLaunchDialogProps = {export function WorkflowLaunchDialog({hiddenVariables,+ launchDisabled = false,open,targetUrl,onOpenChange,@@ -101,6 +111,7 @@ export function WorkflowLaunchDialog({<WorkflowLaunchFormkey={open ? `open:${targetUrl}` : 'closed'}hiddenVariables={supportedVariables}+ launchDisabled={launchDisabled}targetUrl={targetUrl}onClose={() => onOpenChange(false)}/>diff --git a/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsx b/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsxindex 107489dbb6c..6b1b5a51a5f 100644--- a/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsx+++ b/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsx@@ -10,6 +10,7 @@ import userEvent from '@testing-library/user-event'import { NuqsTestingAdapter } from 'nuqs/adapters/testing'import { toast } from '@/app/notifications'import { AgentPermission } from '@/features/agent-v2/acl'+import { AccessMode } from '@/models/access-control'import { consoleQuery } from '@/service/console'import { seedAccountProfileQuery } from '@/test/console/account-profile'import { createQueryClientWrapper } from '@/test/console/query-client'@@ -18,6 +19,8 @@ import { ServiceApiAccessCard } from '../service-api-access-card'import { WebAppAccessCard } from '../web-app-access-card'const mocks = vi.hoisted(() => ({+ getUserCanAccess:+ vi.fn<(appId: string, isInstalledApp: boolean) => Promise<{ result: boolean }>>(),apiAccessQueryFn: vi.fn(),apiKeysQueryFn: vi.fn(),siteEnableMutation: vi.fn(),@@ -31,12 +34,28 @@ const mocks = vi.hoisted(() => ({}))vi.mock('@/app/components/app/app-access-control', () => ({- default: ({ app }: { app: { id: string; access_mode: string } }) => {+ default: ({+ app,+ onConfirm,+ }: {+ app: { id: string; access_mode: string }+ onConfirm: () => Promise<void>+ }) => {mocks.accessControlRender(app)- return <div role="dialog" aria-label="access-control" />+ return (+ <div role="dialog" aria-label="access-control">+ <button type="button" onClick={() => void onConfirm()}>+ Save access control+ </button>+ </div>+ )},}))+vi.mock('@/service/share', () => ({+ getUserCanAccess: mocks.getUserCanAccess,+}))+vi.mock('@/context/i18n', () => ({useDocLink: () => (path: string) => `https://docs.example.test${path}`,}))@@ -339,10 +358,123 @@ function createDeferredPromise<T>() {describe('Agent access surface cards', () => {beforeEach(() => {vi.clearAllMocks()+ mocks.getUserCanAccess.mockResolvedValue({ result: true })mocks.accessSubjectsQueryFn.mockResolvedValue({ groups: [], members: [] })})describe('Web app access', () => {+ it('disables Open when the user cannot access the backing Web App', async () => {+ const user = userEvent.setup()+ mocks.getUserCanAccess.mockResolvedValue({ result: false })+ renderWithQueryClient(+ <WebAppAccessCard+ agent={createAgent({+ access_mode: AccessMode.SPECIFIC_GROUPS_MEMBERS,+ app_id: 'source-app-1',+ backing_app_id: 'backing-app-1',+ })}+ agentId="agent-1"+ isLoading={false}+ />,+ )++ const openButton = screen.getByRole('button', {+ name: 'agentV2.agentDetail.access.webApp.actions.open',+ })+ await user.hover(openButton)++ expect(await screen.findByText('app.noAccessPermission')).toBeVisible()+ expect(openButton).toHaveAttribute('aria-disabled', 'true')+ expect(screen.queryByRole('link', { name: /webApp\.actions\.open/ })).not.toBeInTheDocument()+ expect(mocks.getUserCanAccess).toHaveBeenCalledWith('backing-app-1', true)+ })++ it('keeps Open disabled until Web App access is confirmed', async () => {+ const permission = createDeferredPromise<{ result: boolean }>()+ mocks.getUserCanAccess.mockReturnValueOnce(permission.promise)+ renderWithQueryClient(+ <WebAppAccessCard+ agent={createAgent({ access_mode: AccessMode.ORGANIZATION })}+ agentId="agent-1"+ isLoading={false}+ />,+ )++ expect(screen.getByRole('button', { name: /webApp\.actions\.open/ })).toHaveAttribute(+ 'aria-disabled',+ 'true',+ )++ permission.resolve({ result: true })++ expect(await screen.findByRole('link', { name: /webApp\.actions\.open/ })).toHaveAttribute(+ 'href',+ 'https://chat.example.test/agent/site-token',+ )+ })++ it('allows external-member Web Apps without platform access', () => {+ mocks.getUserCanAccess.mockResolvedValue({ result: false })+ renderWithQueryClient(+ <WebAppAccessCard+ agent={createAgent({ access_mode: AccessMode.EXTERNAL_MEMBERS })}+ agentId="agent-1"+ isLoading={false}+ />,+ )++ expect(screen.getByRole('link', { name: /webApp\.actions\.open/ })).toHaveAttribute(+ 'href',+ 'https://chat.example.test/agent/site-token',+ )+ })++ it('allows opening without a permission query when Web App auth is disabled', () => {+ renderWithQueryClient(+ <WebAppAccessCard+ agent={createAgent({ access_mode: AccessMode.ORGANIZATION })}+ agentId="agent-1"+ isLoading={false}+ />,+ { webAppAuthEnabled: false },+ )++ expect(screen.getByRole('link', { name: /webApp\.actions\.open/ })).toHaveAttribute(+ 'href',+ 'https://chat.example.test/agent/site-token',+ )+ expect(mocks.getUserCanAccess).not.toHaveBeenCalled()+ })++ it('refreshes Open after saving Web App access permissions', async () => {+ const user = userEvent.setup()+ mocks.getUserCanAccess.mockResolvedValue({ result: false })+ renderWithQueryClient(+ <WebAppAccessCard+ agent={createAgent({ access_mode: AccessMode.SPECIFIC_GROUPS_MEMBERS })}+ agentId="agent-1"+ isLoading={false}+ />,+ )++ await user.click(+ screen.getByRole('button', { name: /accessControlDialog\.accessItems\.specific/ }),+ )+ const dialog = await screen.findByRole('dialog', { name: 'access-control' })+ expect(screen.getByRole('button', { name: /webApp\.actions\.open/ })).toHaveAttribute(+ 'aria-disabled',+ 'true',+ )++ mocks.getUserCanAccess.mockResolvedValue({ result: true })+ await user.click(within(dialog).getByRole('button', { name: 'Save access control' }))++ expect(await screen.findByRole('link', { name: /webApp\.actions\.open/ })).toHaveAttribute(+ 'href',+ 'https://chat.example.test/agent/site-token',+ )+ })+it('should serialize Web App toggles and cache each confirmed response', async () => {const user = userEvent.setup()const firstToggle = createDeferredPromise<AppDetail>()@@ -575,7 +707,9 @@ describe('Agent access surface cards', () => {it('should save settings through the backing app id and update the agent detail cache', async () => {const user = userEvent.setup()+ mocks.getUserCanAccess.mockResolvedValue({ result: false })const agent = createAgent({+ access_mode: AccessMode.SPECIFIC_GROUPS_MEMBERS,site: {...createAgent().site!,icon_url: 'https://files.example.test/old-icon.png',diff --git a/web/features/agent-v2/agent-detail/access/components/use-web-app-access-control.ts b/web/features/agent-v2/agent-detail/access/components/use-web-app-access-control.tsindex 350b766b44b..464c2fda833 100644--- a/web/features/agent-v2/agent-detail/access/components/use-web-app-access-control.ts+++ b/web/features/agent-v2/agent-detail/access/components/use-web-app-access-control.ts@@ -7,7 +7,10 @@ import { useTranslation } from 'react-i18next'import { getAgentACLCapabilities } from '@/features/agent-v2/acl'import { systemFeaturesQueryOptions } from '@/features/system-features/client'import { AccessMode, isAccessMode } from '@/models/access-control'-import { useAppWhiteListSubjects } from '@/service/access-control/use-app-access-control'+import {+ useAppWhiteListSubjects,+ useGetUserCanAccessApp,+} from '@/service/access-control/use-app-access-control'const ACCESS_MODE_ICON_MAP: Record<AccessMode, string> = {[AccessMode.ORGANIZATION]: 'i-ri-building-line',@@ -36,6 +39,15 @@ export function useWebAppAccessControl(})const { canReleaseAndVersion: canManage } = getAgentACLCapabilities(agent?.permission_keys)const hasAccessControl = Boolean(webAppAuthEnabled && appId && accessMode)+ const { data: userCanAccessApp, refetch: refetchUserCanAccessApp } = useGetUserCanAccessApp({+ appId,+ enabled: Boolean(webAppAuthEnabled && appId),+ })+ const accessPermission = {+ noAccessPermission:+ webAppAuthEnabled && accessMode !== AccessMode.EXTERNAL_MEMBERS && !userCanAccessApp?.result,+ refetchUserCanAccessApp,+ }const { data: accessSubjects } = useAppWhiteListSubjects(appId,hasAccessControl && canManage && accessMode === AccessMode.SPECIFIC_GROUPS_MEMBERS,@@ -45,11 +57,12 @@ export function useWebAppAccessControl(accessMode !== AccessMode.SPECIFIC_GROUPS_MEMBERS ||Boolean(accessSubjects.groups.length || accessSubjects.members.length)- if (!webAppAuthEnabled) return { state: 'hidden' as const }- if (isLoading) return { state: 'loading' as const }- if (!appId || !accessMode) return { state: 'hidden' as const }+ if (!webAppAuthEnabled) return { ...accessPermission, state: 'hidden' as const }+ if (isLoading) return { ...accessPermission, state: 'loading' as const }+ if (!appId || !accessMode) return { ...accessPermission, state: 'hidden' as const }return {+ ...accessPermission,state: 'ready' as const,app: { id: appId, access_mode: accessMode },entryProps: {diff --git a/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsx b/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsxindex 6674d0ca221..698de108472 100644--- a/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsx+++ b/web/features/agent-v2/agent-detail/access/components/web-app-access-card.tsx@@ -40,6 +40,7 @@ export function WebAppAccessCard({}) {const { t } = useTranslation('agentV2')const { t: tCommon } = useTranslation('common')+ const { t: tApp } = useTranslation('app')const queryClient = useQueryClient()const appId = agent?.app_idconst apiBaseUrl = agent?.api_base_url@@ -151,7 +152,11 @@ export function WebAppAccessCard({const icon = agent ? getSettingsIcon(agent) : nullconst notAvailableLabel = t(($) => $['agentDetail.access.workflow.notAvailable'])const openUrl =- accessReady && webAppUrl && agent?.enable_site && !toggleSiteMutation.isPending+ accessReady &&+ webAppUrl &&+ agent?.enable_site &&+ !toggleSiteMutation.isPending &&+ !accessControl.noAccessPermission? webAppUrl: undefinedconst publishRequiredMessage = t(($) => $['agentDetail.access.publishRequired'])@@ -297,7 +302,13 @@ export function WebAppAccessCard({showOpenshowQrCodeshowRegenerate- openDisabledReason={showPublishRequiredMessage ? publishRequiredMessage : undefined}+ openDisabledReason={+ showPublishRequiredMessage+ ? publishRequiredMessage+ : accessControl.noAccessPermission+ ? tApp(($) => $.noAccessPermission)+ : undefined+ }openLabel={t(($) => $['agentDetail.access.webApp.actions.open'])}openUrl={openUrl}qrCodeLabel={t(($) => $['agentDetail.access.webApp.showQrCode'])}@@ -354,7 +365,10 @@ export function WebAppAccessCard({<AccessControlapp={accessControl.app}onClose={() => setShowAccessControl(false)}- onConfirm={() => setShowAccessControl(false)}+ onConfirm={async () => {+ await accessControl.refetchUserCanAccessApp()+ setShowAccessControl(false)+ }}/>)}</>