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.

feat: use app.acl.access_point_manage to control access point page access (#41462)

wangxiaolei6a00c23e492a
diff --git a/api/controllers/console/agent/roster.py b/api/controllers/console/agent/roster.py
index f95f9d8b00f..730dd7b1a57 100644
--- a/api/controllers/console/agent/roster.py
+++ b/api/controllers/console/agent/roster.py
@@ -7,6 +7,7 @@ from pydantic import AliasChoices, BaseModel, Field, field_validator
from sqlalchemy import func, or_, select
from sqlalchemy.orm import Session
+from configs import dify_config
from controllers.common.schema import (
query_params_from_model,
query_params_from_request,
@@ -78,9 +79,11 @@ from services.agent.observability_service import (
)
from services.agent.roster_service import AgentRosterService
from services.app_service import AgentAppPublicationCounts, AppListParams, AppService, CreateAppParams
+from services.enterprise import rbac_service as enterprise_rbac_service
from services.enterprise.enterprise_service import EnterpriseService
from services.entities.agent_entities import ComposerSavePayload, RosterListQuery
from services.feature_service import FeatureService
+from tasks.initialize_created_app_rbac_access_task import initialize_created_app_rbac_access_task
AgentPublicationStatus = Literal["published", "drafts"]
@@ -684,6 +687,15 @@ class AgentAppListApi(Resource):
)
app = AppService().create_app(current_tenant_id, params, current_user, session=session)
+ if dify_config.RBAC_ENABLED:
+ enterprise_rbac_service.RBACService.AppAccess.replace_whitelist(
+ current_tenant_id,
+ current_user.id,
+ str(app.id),
+ enterprise_rbac_service.ReplaceMemberBindings(automatic_include_workspace_members=True),
+ )
+ initialize_created_app_rbac_access_task.delay(current_tenant_id, current_user.id, app_id=app.id)
+
return _serialize_agent_app_detail(session, app, current_user=current_user), 201
diff --git a/api/services/enterprise/rbac_service.py b/api/services/enterprise/rbac_service.py
index b9a6db00e00..b3d1bfac0fd 100644
--- a/api/services/enterprise/rbac_service.py
+++ b/api/services/enterprise/rbac_service.py
@@ -475,6 +475,7 @@ _LEGACY_WORKSPACE_DATASET_OPERATOR_KEYS: list[str] = [
_LEGACY_APP_OWNER_KEYS: list[str] = [
"app.acl.preview",
+ "app.acl.access_point_manage",
"app.acl.view_layout",
"app.acl.test_and_run",
"app.acl.edit",
@@ -490,6 +491,7 @@ _LEGACY_APP_OWNER_KEYS: list[str] = [
_LEGACY_APP_ADMIN_KEYS: list[str] = [
"app.acl.preview",
"app.acl.view_layout",
+ "app.acl.access_point_manage",
"app.acl.test_and_run",
"app.acl.edit",
"app.acl.import_export_dsl",
@@ -504,6 +506,7 @@ _LEGACY_APP_ADMIN_KEYS: list[str] = [
_LEGACY_APP_EDITOR_KEYS: list[str] = [
"app.acl.preview",
+ "app.acl.access_point_manage",
"app.acl.view_layout",
"app.acl.test_and_run",
"app.acl.edit",
diff --git a/api/tests/unit_tests/controllers/console/agent/test_agent_controllers.py b/api/tests/unit_tests/controllers/console/agent/test_agent_controllers.py
index c2b43d8cb22..27a543fd2a2 100644
--- a/api/tests/unit_tests/controllers/console/agent/test_agent_controllers.py
+++ b/api/tests/unit_tests/controllers/console/agent/test_agent_controllers.py
@@ -1,3 +1,4 @@
+from collections.abc import Callable
from datetime import datetime
from inspect import getsource, unwrap
from types import SimpleNamespace
@@ -308,9 +309,15 @@ def account_id() -> str:
def test_agent_app_list_and_create_use_agent_route(
- app: Flask, monkeypatch: pytest.MonkeyPatch, account_id: str, sqlite_session: Session
+ app: Flask,
+ monkeypatch: pytest.MonkeyPatch,
+ account_id: str,
+ sqlite_session: Session,
+ config_overrides: Callable[..., None],
) -> None:
captured: dict[str, object] = {}
+ replace_whitelist = MagicMock()
+ initialize_access = MagicMock()
class FakeAppService:
def get_app(self, app_obj: object, *, session: object) -> object:
@@ -396,7 +403,9 @@ def test_agent_app_list_and_create_use_agent_route(
lambda _self, **kwargs: {"agent-list": "debug-conversation-list"},
)
monkeypatch.setattr(
- roster_controller.AgentRosterService, "count_agent_app_debug_conversation_messages", lambda _self, **kwargs: 0
+ roster_controller.AgentRosterService,
+ "count_agent_app_debug_conversation_messages",
+ lambda _self, **kwargs: 0,
)
def get_or_create_debug_conversation(_self: object, **kwargs: object) -> str:
@@ -413,6 +422,13 @@ def test_agent_app_list_and_create_use_agent_route(
"get_system_features",
lambda: SimpleNamespace(webapp_auth=SimpleNamespace(enabled=False)),
)
+ config_overrides(RBAC_ENABLED=True)
+ monkeypatch.setattr(
+ roster_controller.enterprise_rbac_service.RBACService.AppAccess,
+ "replace_whitelist",
+ replace_whitelist,
+ )
+ monkeypatch.setattr(roster_controller.initialize_created_app_rbac_access_task, "delay", initialize_access)
with app.test_request_context(
"/console/api/agent?page=1&limit=10&mode=workflow&sort_by=recently_created"
"&is_created_by_me=true&publication_status=published"
@@ -453,12 +469,22 @@ def test_agent_app_list_and_create_use_agent_route(
assert count_params.agent_is_published is True
with app.test_request_context(
"/console/api/agent",
- json={"name": "Iris", "description": "Agent app", "role": "Coordinator", "icon_type": "emoji", "icon": "robot"},
+ json={
+ "name": "Iris",
+ "description": "Agent app",
+ "role": "Coordinator",
+ "icon_type": "emoji",
+ "icon": "robot",
+ },
):
created, status = unwrap(AgentAppListApi.post)(
AgentAppListApi(),
AgentAppCreatePayload(
- name="Iris", description="Agent app", role="Coordinator", icon_type="emoji", icon="robot"
+ name="Iris",
+ description="Agent app",
+ role="Coordinator",
+ icon_type="emoji",
+ icon="robot",
),
sqlite_session,
"tenant-1",
@@ -481,6 +507,81 @@ def test_agent_app_list_and_create_use_agent_route(
"account_id": account_id,
"commit": False,
}
+ replace_whitelist.assert_called_once()
+ assert replace_whitelist.call_args.args[:3] == ("tenant-1", account_id, "app-created")
+ replace_payload = replace_whitelist.call_args.args[3]
+ assert replace_payload.automatic_include_workspace_members is True
+ initialize_access.assert_called_once_with("tenant-1", account_id, app_id="app-created")
+
+
+def test_agent_app_create_skips_rbac_access_initialization_when_rbac_is_disabled(
+ app: Flask,
+ monkeypatch: pytest.MonkeyPatch,
+ account_id: str,
+ sqlite_session: Session,
+ config_overrides: Callable[..., None],
+) -> None:
+ replace_whitelist = MagicMock()
+ initialize_access = MagicMock()
+
+ class FakeAppService:
+ def get_app(self, app_obj: object, *, session: object) -> object:
+ return app_obj
+
+ def create_app(self, tenant_id: str, params, current_user: object, *, session: object) -> object:
+ return _app_detail_obj(id="app-created", bound_agent_id="agent-created")
+
+ monkeypatch.setattr(roster_controller, "AppService", FakeAppService)
+ monkeypatch.setattr(
+ roster_controller.AgentRosterService,
+ "get_app_backing_agent",
+ lambda _self, **kwargs: Agent(
+ id="agent-created",
+ app_id="app-created",
+ backing_app_id=None,
+ role="Created role",
+ active_config_snapshot_id=None,
+ ),
+ )
+ monkeypatch.setattr(
+ roster_controller.AgentRosterService,
+ "get_or_create_build_conversation",
+ lambda _self, **kwargs: "debug-conversation-created",
+ )
+ monkeypatch.setattr(
+ roster_controller.AgentRosterService, "count_agent_app_debug_conversation_messages", lambda _self, **kwargs: 0
+ )
+ monkeypatch.setattr(
+ roster_controller.FeatureService,
+ "get_system_features",
+ lambda: SimpleNamespace(webapp_auth=SimpleNamespace(enabled=False)),
+ )
+ config_overrides(RBAC_ENABLED=False)
+ monkeypatch.setattr(
+ roster_controller.enterprise_rbac_service.RBACService.AppAccess,
+ "replace_whitelist",
+ replace_whitelist,
+ )
+ monkeypatch.setattr(roster_controller.initialize_created_app_rbac_access_task, "delay", initialize_access)
+
+ with app.test_request_context(
+ "/console/api/agent",
+ json={"name": "Iris", "description": "Agent app", "role": "Coordinator", "icon_type": "emoji", "icon": "robot"},
+ ):
+ created, status = unwrap(AgentAppListApi.post)(
+ AgentAppListApi(),
+ AgentAppCreatePayload(
+ name="Iris", description="Agent app", role="Coordinator", icon_type="emoji", icon="robot"
+ ),
+ sqlite_session,
+ "tenant-1",
+ _account(account_id=account_id),
+ )
+
+ assert status == 201
+ assert created["id"] == "agent-created"
+ replace_whitelist.assert_not_called()
+ initialize_access.assert_not_called()
def test_agent_app_create_payload_allows_optional_role() -> None:
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/__tests__/layout-main.spec.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/__tests__/layout-main.spec.tsx
index 8c6acc78866..9a52e32d0e7 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/__tests__/layout-main.spec.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/__tests__/layout-main.spec.tsx
@@ -238,9 +238,11 @@ describe('AppDetailLayout', () => {
expect(useStore.getState().appDetail?.id).toBe('app-1')
})
- it('should allow access point pages without app deploy or app ACL permissions', async () => {
+ it('should allow users with access point permission to open access point directly', async () => {
mockPathname = '/app/app-1/access-point'
- mockFetchAppDetailDirect.mockResolvedValue(createAppDetail({ permission_keys: [] }))
+ mockFetchAppDetailDirect.mockResolvedValue(
+ createAppDetail({ permission_keys: [AppACLPermission.AccessPoint] }),
+ )
render(
<AppDetailLayout appId="app-1">
@@ -254,6 +256,44 @@ describe('AppDetailLayout', () => {
expect(useStore.getState().appDetail?.id).toBe('app-1')
})
+ it('should redirect access point pages when access point permission is missing', async () => {
+ mockPathname = '/app/app-1/access-point'
+ mockFetchAppDetailDirect.mockResolvedValue(
+ createAppDetail({ permission_keys: [AppACLPermission.Monitor] }),
+ )
+
+ render(
+ <AppDetailLayout appId="app-1">
+ <div>App page content</div>
+ </AppDetailLayout>,
+ )
+
+ await waitFor(() => {
+ expect(mockReplace).toHaveBeenCalledWith('/app/app-1/overview')
+ })
+ expect(screen.queryByText('App page content')).not.toBeInTheDocument()
+ expect(useStore.getState().appDetail).toBeUndefined()
+ })
+
+ it('should keep access point content hidden while redirecting cached app data without permission', async () => {
+ mockPathname = '/app/app-1/access-point'
+ useStore
+ .getState()
+ .setAppDetail(createAppDetail({ permission_keys: [AppACLPermission.Monitor] }))
+
+ render(
+ <AppDetailLayout appId="app-1">
+ <div>App page content</div>
+ </AppDetailLayout>,
+ )
+
+ expect(screen.queryByText('App page content')).not.toBeInTheDocument()
+ await waitFor(() => {
+ expect(mockReplace).toHaveBeenCalledWith('/app/app-1/overview')
+ })
+ expect(mockFetchAppDetailDirect).not.toHaveBeenCalled()
+ })
+
it('should redirect deploy pages when app deploy ACL permission is missing', async () => {
mockPathname = '/app/app-1/deploy'
mockFetchAppDetailDirect.mockResolvedValue(
@@ -317,7 +357,7 @@ describe('AppDetailLayout', () => {
)
await waitFor(() => {
- expect(mockReplace).toHaveBeenCalledWith('/app/app-1/access-point')
+ expect(mockReplace).toHaveBeenCalledWith('/apps')
})
expect(screen.queryByText('App page content')).not.toBeInTheDocument()
expect(useStore.getState().appDetail).toBeUndefined()
@@ -488,7 +528,7 @@ describe('AppDetailLayout', () => {
)
await waitFor(() => {
- expect(mockReplace).toHaveBeenCalledWith('/app/app-1/access-point')
+ expect(mockReplace).toHaveBeenCalledWith('/apps')
})
expect(screen.queryByText('App page content')).not.toBeInTheDocument()
expect(useStore.getState().appDetail).toBeUndefined()
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx
index 7f9f6973ca8..df55021f289 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx
@@ -78,8 +78,28 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
appDetail?.id === appId ? appDetail : appDetailRes?.id === appId ? appDetailRes : null
const pageTitle = appDetailPageTitle(pathname, t)
const appName = routeAppDetail?.id === appId ? routeAppDetail.name : undefined
+ const isAppACLContextReady =
+ !!routeAppDetail &&
+ !!currentWorkspace.id &&
+ !isLoadingCurrentWorkspace &&
+ !isLoadingWorkspacePermissionKeys &&
+ !isLoadingAppDetail
+ const appACLCapabilities = React.useMemo(
+ () =>
+ routeAppDetail && isAppACLContextReady
+ ? getAppACLCapabilities(routeAppDetail.permission_keys, {
+ currentUserId,
+ resourceMaintainer: routeAppDetail.maintainer,
+ workspacePermissionKeys,
+ isRbacEnabled,
+ })
+ : null,
+ [currentUserId, isAppACLContextReady, isRbacEnabled, routeAppDetail, workspacePermissionKeys],
+ )
const shouldBlockAgentResourceAccess =
routeAppDetail?.mode === AppModeEnum.AGENT && pathname.endsWith('/access-config')
+ const shouldBlockAccessPointAccess =
+ pathname.endsWith('/access-point') && !appACLCapabilities?.canAccessPoint
useDocumentTitle(`${pageTitle} · ${appName || t(($) => $['menus.appDetail'], { ns: 'common' })}`)
@@ -120,28 +140,16 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
}, [appId, router, setAppDetail])
useEffect(() => {
- if (
- !routeAppDetail ||
- !currentWorkspace.id ||
- isLoadingCurrentWorkspace ||
- isLoadingWorkspacePermissionKeys ||
- isLoadingAppDetail
- )
- return
+ if (!routeAppDetail || !isAppACLContextReady || !appACLCapabilities) return
if (routeAppDetail.id !== appId) return
- const appACLCapabilities = getAppACLCapabilities(routeAppDetail.permission_keys, {
- currentUserId,
- resourceMaintainer: routeAppDetail.maintainer,
- workspacePermissionKeys,
- isRbacEnabled,
- })
const isLayoutPath = pathname.endsWith('configuration') || pathname.endsWith('workflow')
const isLogsPath = pathname.endsWith('logs')
const isAnnotationsPath = pathname.endsWith('annotations')
const isOverviewPath = pathname.endsWith('overview')
const isAccessConfigPath = pathname.endsWith('access-config')
const isDeployPath = pathname.endsWith('deploy')
+ const isAccessPointPath = pathname.endsWith('access-point')
if (
(isLayoutPath && !appACLCapabilities.canAccessLayout) ||
(isLogsPath && !appACLCapabilities.canAccessLogAndAnnotation) ||
@@ -150,7 +158,8 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
(isAccessConfigPath &&
(routeAppDetail.mode === AppModeEnum.AGENT || !appACLCapabilities.canAccessConfig)) ||
(isDeployPath &&
- (routeAppDetail.mode !== AppModeEnum.WORKFLOW || !appACLCapabilities.canDeploy))
+ (routeAppDetail.mode !== AppModeEnum.WORKFLOW || !appACLCapabilities.canDeploy)) ||
+ (isAccessPointPath && !appACLCapabilities.canAccessPoint)
) {
router.replace(
getRedirectionPath(routeAppDetail, {
@@ -180,14 +189,12 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
if (appDetailRes && appDetail?.id !== appDetailRes.id)
setAppDetail({ ...appDetailRes, enable_sso: false })
}, [
+ appACLCapabilities,
appDetail?.id,
appDetailRes,
appId,
currentUserId,
- currentWorkspace.id,
- isLoadingAppDetail,
- isLoadingCurrentWorkspace,
- isLoadingWorkspacePermissionKeys,
+ isAppACLContextReady,
isRbacEnabled,
pathname,
routeAppDetail,
@@ -198,7 +205,7 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (props) => {
const isWorkflowPage = pathname.endsWith('/workflow')
const content =
- !appDetail || shouldBlockAgentResourceAccess ? (
+ !appDetail || shouldBlockAgentResourceAccess || shouldBlockAccessPointAccess ? (
<div className="flex min-w-0 grow items-center justify-center bg-background-body">
<Loading />
</div>
diff --git a/web/app/components/app-sidebar/__tests__/app-detail-section.spec.tsx b/web/app/components/app-sidebar/__tests__/app-detail-section.spec.tsx
index e84d925dbdc..0ff08042648 100644
--- a/web/app/components/app-sidebar/__tests__/app-detail-section.spec.tsx
+++ b/web/app/components/app-sidebar/__tests__/app-detail-section.spec.tsx
@@ -186,7 +186,10 @@ describe('AppDetailSection', () => {
).not.toBeInTheDocument()
})
- it('should render access point navigation using its app route', () => {
+ it('should render access point navigation when access point permission is granted', () => {
+ // Arrange
+ mockAppPermissionKeys = [AppACLPermission.AccessPoint]
+
// Act
render(<AppDetailSection />)
@@ -200,6 +203,19 @@ describe('AppDetailSection', () => {
).not.toBeInTheDocument()
})
+ it('should hide access point navigation when access point permission is missing', () => {
+ // Arrange
+ mockAppPermissionKeys = [AppACLPermission.Monitor]
+
+ // Act
+ render(<AppDetailSection />)
+
+ // Assert
+ expect(
+ screen.queryByRole('link', { name: 'common.appMenus.accessPoint' }),
+ ).not.toBeInTheDocument()
+ })
+
it('should render deploy navigation with app deploy ACL regardless of the legacy workspace role', () => {
// Arrange
mockAppMode = 'workflow'
diff --git a/web/app/components/app-sidebar/app-detail-section.tsx b/web/app/components/app-sidebar/app-detail-section.tsx
index 3176e2cac21..677ac50aea4 100644
--- a/web/app/components/app-sidebar/app-detail-section.tsx
+++ b/web/app/components/app-sidebar/app-detail-section.tsx
@@ -120,12 +120,16 @@ const AppDetailSection = ({ expand = true }: AppDetailSectionProps) => {
},
]
: []),
- {
- name: t(($) => $['appMenus.accessPoint'], { ns: 'common' }),
- href: `/app/${appId}/access-point`,
- icon: accessPointNavIcon,
- selectedIcon: accessPointNavIcon,
- },
+ ...(appACLCapabilities.canAccessPoint
+ ? [
+ {
+ name: t(($) => $['appMenus.accessPoint'], { ns: 'common' }),
+ href: `/app/${appId}/access-point`,
+ icon: accessPointNavIcon,
+ selectedIcon: accessPointNavIcon,
+ },
+ ]
+ : []),
...(supportsAppDeploy && appACLCapabilities.canDeploy
? [
{
diff --git a/web/app/components/app/app-publisher/__tests__/environment-deployment-flow.spec.tsx b/web/app/components/app/app-publisher/__tests__/environment-deployment-flow.spec.tsx
index 8aa12ed5457..9c80ad25f11 100644
--- a/web/app/components/app/app-publisher/__tests__/environment-deployment-flow.spec.tsx
+++ b/web/app/components/app/app-publisher/__tests__/environment-deployment-flow.spec.tsx
@@ -295,6 +295,7 @@ function renderFlow(
return render(
<PublisherEnvironmentFlow
appId="app-1"
+ canAccessPoint
deployment={deployment}
environmentId={deployment.environment.id}
environmentName={deployment.environment.display_name}
@@ -334,6 +335,7 @@ function renderFlowWithPolling(deployment = createDeployment()) {
<PublisherPollingObserver />
<PublisherEnvironmentFlow
appId="app-1"
+ canAccessPoint
deployment={deployment}
environmentId={deployment.environment.id}
environmentName={deployment.environment.display_name}
diff --git a/web/app/components/app/app-publisher/__tests__/sections.spec.tsx b/web/app/components/app/app-publisher/__tests__/sections.spec.tsx
index 9090a86bbd4..11c0b1daf3f 100644
--- a/web/app/components/app/app-publisher/__tests__/sections.spec.tsx
+++ b/web/app/components/app/app-publisher/__tests__/sections.spec.tsx
@@ -6,6 +6,7 @@ import { renderWithConsoleQuery as render } from '@/test/console/query-data'
import { AppModeEnum } from '@/types/app'
import { PublisherActionsSection } from '../built-in-publisher/actions-section'
import { PublisherSummarySection } from '../built-in-publisher/summary-section'
+import { PublisherEnvironmentActionsSection } from '../environment-deployment-flow/actions-section'
vi.mock('../publish-with-multiple-model', () => ({
default: ({
@@ -314,6 +315,7 @@ describe('app-publisher sections', () => {
description: 'Workflow description',
}}
appURL="https://example.com/app"
+ canAccessPoint
disabledFunctionButton={false}
disabledFunctionTooltip="disabled"
handleOpenRunConfig={handleOpenRunConfig}
@@ -494,6 +496,7 @@ describe('app-publisher sections', () => {
mode: AppModeEnum.WORKFLOW,
}}
appURL="https://example.com/app"
+ canAccessPoint
disabledFunctionButton={false}
hasHumanInputNode={false}
hasTriggerNode
@@ -517,11 +520,49 @@ describe('app-publisher sections', () => {
)
})
+ it('should hide the built-in Access Point action without permission', () => {
+ render(
+ <PublisherActionsSection
+ appDetail={{ id: 'workflow-app', mode: AppModeEnum.WORKFLOW }}
+ appURL="https://example.com/app"
+ canAccessPoint={false}
+ disabledFunctionButton={false}
+ hasHumanInputNode={false}
+ hasTriggerNode
+ publishedAt={Date.now()}
+ showDeployAction
+ workflowToolAvailable
+ workflowToolIsLoading={false}
+ onConfigureWorkflowTool={vi.fn()}
+ />,
+ )
+
+ expect(screen.queryByText(/(?:^|\.)appMenus\.accessPoint(?=$|:)/)).not.toBeInTheDocument()
+ expect(screen.getByRole('link', { name: /appMenus\.deploy\b/ })).toHaveAttribute(
+ 'href',
+ '/app/workflow-app/deploy',
+ )
+ })
+
+ it('should hide the environment Access Point action without permission', () => {
+ render(
+ <PublisherEnvironmentActionsSection
+ appId="workflow-app"
+ canAccessPoint={false}
+ environmentId="staging"
+ />,
+ )
+
+ expect(screen.queryByText(/(?:^|\.)appMenus\.accessPoint(?=$|:)/)).not.toBeInTheDocument()
+ expect(screen.getByText(/(?:^|\.)appMenus\.deploy(?=$|:)/)).toBeInTheDocument()
+ })
+
it('should expose unavailable quick links as disabled buttons before the first publish', () => {
render(
<PublisherActionsSection
appDetail={{ id: 'workflow-app', mode: AppModeEnum.WORKFLOW }}
appURL="https://example.com/app"
+ canAccessPoint
disabledFunctionButton
hasHumanInputNode={false}
hasTriggerNode={false}
diff --git a/web/app/components/app/app-publisher/built-in-publisher/actions-section.tsx b/web/app/components/app/app-publisher/built-in-publisher/actions-section.tsx
index c1fe6a27869..f3d120d6314 100644
--- a/web/app/components/app/app-publisher/built-in-publisher/actions-section.tsx
+++ b/web/app/components/app/app-publisher/built-in-publisher/actions-section.tsx
@@ -23,6 +23,7 @@ type PublisherActionsSectionProps = Pick<
| null
| undefined
appURL: string
+ canAccessPoint?: boolean
disabledFunctionButton: boolean
disabledFunctionTooltip?: string
handleOpenRunConfig?: (url: string) => void
@@ -41,6 +42,7 @@ type PublisherActionsSectionProps = Pick<
export function PublisherActionsSection({
appDetail,
appURL,
+ canAccessPoint = false,
disabledFunctionButton,
disabledFunctionTooltip,
handleOpenRunConfig,
@@ -114,14 +116,16 @@ export function PublisherActionsSection({
<TooltipContent role="tooltip">{disabledFunctionTooltip}</TooltipContent>
</Tooltip>
)}
- <SuggestedAction
- disabled={navigationDisabled}
- description={t(($) => $['common.accessPointDescription'], { ns: 'workflow' })}
- link={appId ? `/app/${appId}/access-point` : undefined}
- icon={<span className="i-custom-vender-agent-v2-access-point size-4" />}
- >
- {t(($) => $['appMenus.accessPoint'], { ns: 'common' })}
- </SuggestedAction>
+ {canAccessPoint && (
+ <SuggestedAction
+ disabled={navigationDisabled}
+ description={t(($) => $['common.accessPointDescription'], { ns: 'workflow' })}
+ link={appId ? `/app/${appId}/access-point` : undefined}
+ icon={<span className="i-custom-vender-agent-v2-access-point size-4" />}
+ >
+ {t(($) => $['appMenus.accessPoint'], { ns: 'common' })}
+ </SuggestedAction>
+ )}
{showDeploy && (
<SuggestedAction
disabled={navigationDisabled}
diff --git a/web/app/components/app/app-publisher/environment-deployment-flow/actions-section.tsx b/web/app/components/app/app-publisher/environment-deployment-flow/actions-section.tsx
index 34dd368a134..69ef07826e0 100644
--- a/web/app/components/app/app-publisher/environment-deployment-flow/actions-section.tsx
+++ b/web/app/components/app/app-publisher/environment-deployment-flow/actions-section.tsx
@@ -8,10 +8,12 @@ function environmentHref(path: string, appId: string, environmentId: string) {
export function PublisherEnvironmentActionsSection({
appId,
+ canAccessPoint = false,
deployment,
environmentId,
}: {
appId?: string
+ canAccessPoint?: boolean
deployment?: EnvironmentDeployment
environmentId: string
}) {
@@ -22,14 +24,16 @@ export function PublisherEnvironmentActionsSection({
return (
<div className="flex flex-col border-t-[0.5px] border-t-divider-regular p-3">
- <SuggestedAction
- disabled={actionsDisabled}
- description={t(($) => $['common.accessPointDescription'], { ns: 'workflow' })}
- link={accessPointHref}
- icon={<span className="i-custom-vender-agent-v2-access-point size-4" />}
- >
- {t(($) => $['appMenus.accessPoint'], { ns: 'common' })}
- </SuggestedAction>
+ {canAccessPoint && (
+ <SuggestedAction
+ disabled={actionsDisabled}
+ description={t(($) => $['common.accessPointDescription'], { ns: 'workflow' })}
+ link={accessPointHref}
+ icon={<span className="i-custom-vender-agent-v2-access-point size-4" />}
+ >
+ {t(($) => $['appMenus.accessPoint'], { ns: 'common' })}
+ </SuggestedAction>
+ )}
<SuggestedAction
disabled={actionsDisabled}
description={t(($) => $['common.deployDescription'], { ns: 'workflow' })}
diff --git a/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx b/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx
index dce08832bc0..9f0b1201993 100644
--- a/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx
+++ b/web/app/components/app/app-publisher/environment-deployment-flow/index.tsx
@@ -15,6 +15,7 @@ import { PublisherEnvironmentSummarySection } from './summary-section'
type PublisherEnvironmentFlowProps = {
appId?: string
+ canAccessPoint?: boolean
deployment?: EnvironmentDeployment
environmentId: string
environmentName: string
@@ -28,6 +29,7 @@ type PublisherEnvironmentFlowProps = {
export function PublisherEnvironmentFlow({
appId,
+ canAccessPoint = false,
deployment,
environmentId,
environmentName,
@@ -91,6 +93,7 @@ export function PublisherEnvironmentFlow({
/>
<PublisherEnvironmentActionsSection
appId={appId}
+ canAccessPoint={canAccessPoint}
deployment={deployment}
environmentId={environmentId}
/>
diff --git a/web/app/components/app/app-publisher/index.tsx b/web/app/components/app/app-publisher/index.tsx
index 48278b77cfc..38e9b724d1e 100644
--- a/web/app/components/app/app-publisher/index.tsx
+++ b/web/app/components/app/app-publisher/index.tsx
@@ -17,12 +17,13 @@ export function AppPublisher(props: AppPublisherProps) {
select: (data) => data.profile.id,
})
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
- const canDeploy = getAppACLCapabilities(appDetail?.permission_keys, {
+ const appACLCapabilities = getAppACLCapabilities(appDetail?.permission_keys, {
currentUserId,
resourceMaintainer: appDetail?.maintainer,
workspacePermissionKeys,
- }).canDeploy
- const supportsMultiEnvironment = appDetail?.mode === AppModeEnum.WORKFLOW && canDeploy
+ })
+ const supportsMultiEnvironment =
+ appDetail?.mode === AppModeEnum.WORKFLOW && appACLCapabilities.canDeploy
return (
<AppPublisherStateBoundary
@@ -31,6 +32,7 @@ export function AppPublisher(props: AppPublisherProps) {
>
<PublisherContent
{...props}
+ canAccessPoint={appACLCapabilities.canAccessPoint}
open={open}
supportsMultiEnvironment={supportsMultiEnvironment}
onOpenStateChange={setOpen}
diff --git a/web/app/components/app/app-publisher/publisher-content/index.tsx b/web/app/components/app/app-publisher/publisher-content/index.tsx
index 945e879331b..ab07c5154ca 100644
--- a/web/app/components/app/app-publisher/publisher-content/index.tsx
+++ b/web/app/components/app/app-publisher/publisher-content/index.tsx
@@ -33,12 +33,14 @@ import { useWorkflowLaunch } from './use-workflow-launch'
import { useWorkflowTool } from './use-workflow-tool'
type PublisherContentProps = AppPublisherProps & {
+ canAccessPoint: boolean
open: boolean
supportsMultiEnvironment: boolean
onOpenStateChange: (open: boolean) => void
}
export function PublisherContent({
+ canAccessPoint,
crossAxisOffset = 0,
debugWithMultipleModel = false,
disabled = false,
@@ -212,6 +214,7 @@ export function PublisherContent({
actions: {
appDetail,
appURL,
+ canAccessPoint,
disabledFunctionButton,
disabledFunctionTooltip,
handleOpenRunConfig: workflowLaunch.openDialog,
@@ -236,6 +239,7 @@ export function PublisherContent({
disabled={disabled}
environmentPublisher={{
appId: appDetail?.id,
+ canAccessPoint,
deployment: selectedEnvironmentDeployment,
environmentId: selectedEnvironmentId,
environmentName:
diff --git a/web/app/components/app/deploy/__tests__/index.spec.tsx b/web/app/components/app/deploy/__tests__/index.spec.tsx
index 11888a09817..79c1f082294 100644
--- a/web/app/components/app/deploy/__tests__/index.spec.tsx
+++ b/web/app/components/app/deploy/__tests__/index.spec.tsx
@@ -650,7 +650,7 @@ function render(
return renderWithConsoleQuery(ui, { queryClient })
}
-let appPermissionKeys: string[] = [AppACLPermission.Deploy]
+let appPermissionKeys: string[] = [AppACLPermission.AccessPoint, AppACLPermission.Deploy]
let appDetailAvailable = true
const mockConsoleState = vi.hoisted(() => ({
workspacePermissionKeys: [] as string[],
@@ -744,7 +744,7 @@ vi.mock('@langgenius/dify-ui/toast', () => ({
describe('AppDeploy', () => {
beforeEach(() => {
vi.clearAllMocks()
- appPermissionKeys = [AppACLPermission.Deploy]
+ appPermissionKeys = [AppACLPermission.AccessPoint, AppACLPermission.Deploy]
appDetailAvailable = true
mockBuiltInEnvironment.appDetail.enable_api = false
mockBuiltInEnvironment.appDetail.enable_site = true
@@ -815,6 +815,18 @@ describe('AppDeploy', () => {
).toHaveAttribute('href', '/app/app-1/access-point?environment=canary&accessPoint=serviceApi')
})
+ it('keeps active access points non-navigable without access point permission', () => {
+ appPermissionKeys = [AppACLPermission.Deploy]
+
+ render(<AppDeploy />)
+
+ const canaryRow = within(screen.getByRole('row', { name: /Canary/ }))
+ const webAppLabel =
+ 'agentV2.agentDetail.access.webApp.title · agentV2.agentDetail.access.status.inService'
+ expect(canaryRow.queryByRole('link', { name: webAppLabel })).not.toBeInTheDocument()
+ expect(canaryRow.getByRole('button', { name: webAppLabel })).toBeDisabled()
+ })
+
it('renders the built-in version, access points, and publisher from live app data', () => {
render(<AppDeploy />)
diff --git a/web/app/components/app/deploy/built-in-environment-card/index.tsx b/web/app/components/app/deploy/built-in-environment-card/index.tsx
index d04dce259a8..607250e7ce6 100644
--- a/web/app/components/app/deploy/built-in-environment-card/index.tsx
+++ b/web/app/components/app/deploy/built-in-environment-card/index.tsx
@@ -19,7 +19,7 @@ function Divider() {
return <div className="i-custom-vender-deploy-line-5 h-10 w-3" />
}
-export function BuiltInEnvironmentCard() {
+export function BuiltInEnvironmentCard({ canAccessPoint = false }: { canAccessPoint?: boolean }) {
const { t } = useTranslation('deployments')
const { formatTime } = useTimestamp()
const appDetail = useAppStore((state) => state.appDetail)
@@ -90,7 +90,9 @@ export function BuiltInEnvironmentCard() {
key={accessPoint}
accessPoint={accessPoint}
active={activeAccessPoints[accessPoint]}
- href={getAccessPointHref(appId, 'built-in', accessPoint)}
+ href={
+ canAccessPoint ? getAccessPointHref(appId, 'built-in', accessPoint) : undefined
+ }
/>
))}
</div>
diff --git a/web/app/components/app/deploy/environment-table/index.tsx b/web/app/components/app/deploy/environment-table/index.tsx
index cbee27225ed..cc9b9451e59 100644
--- a/web/app/components/app/deploy/environment-table/index.tsx
+++ b/web/app/components/app/deploy/environment-table/index.tsx
@@ -23,6 +23,7 @@ import { EnvironmentRow } from './row'
type EnvironmentTableProps = {
appId: string
+ canAccessPoint?: boolean
onChangeVersion?: (deployment: EnvironmentDeployment) => void
onDeployLatest?: (deployment: EnvironmentDeployment) => void
onDeployToEnvironment?: (environment: AppEnvironment) => void
@@ -32,6 +33,7 @@ type EnvironmentTableProps = {
export function EnvironmentTable({
appId,
+ canAccessPoint = false,
onChangeVersion,
onDeployLatest,
onDeployToEnvironment,
@@ -132,6 +134,7 @@ export function EnvironmentTable({
<EnvironmentRow
key={row.environment.id}
appId={appId}
+ canAccessPoint={canAccessPoint}
row={row}
onChangeVersion={onChangeVersion}
onDeployLatest={onDeployLatest}
diff --git a/web/app/components/app/deploy/environment-table/row.tsx b/web/app/components/app/deploy/environment-table/row.tsx
index 9e652008b67..c28b2e75f90 100644
--- a/web/app/components/app/deploy/environment-table/row.tsx
+++ b/web/app/components/app/deploy/environment-table/row.tsx
@@ -10,6 +10,7 @@ import { EnvironmentRowActions } from './row-actions'
export function EnvironmentRow({
appId,
+ canAccessPoint = false,
row,
onChangeVersion,
onDeployLatest,
@@ -17,6 +18,7 @@ export function EnvironmentRow({
onUndeploy,
}: {
appId: string
+ canAccessPoint?: boolean
row: EnvironmentDeployment
onChangeVersion?: (deployment: EnvironmentDeployment) => void
onDeployLatest?: (deployment: EnvironmentDeployment) => void
@@ -60,7 +62,11 @@ export function EnvironmentRow({
key={accessPoint}
accessPoint={accessPoint}
active={isAccessPointActive(accessPoint)}
- href={getAccessPointHref(appId, row.environment.id, accessPoint)}
+ href={
+ canAccessPoint
+ ? getAccessPointHref(appId, row.environment.id, accessPoint)
+ : undefined
+ }
/>
))}
</div>
diff --git a/web/app/components/app/deploy/index.tsx b/web/app/components/app/deploy/index.tsx
index c22034584dd..4f1bee0ed1e 100644
--- a/web/app/components/app/deploy/index.tsx
+++ b/web/app/components/app/deploy/index.tsx
@@ -22,7 +22,7 @@ import { useRefreshAppEnvironmentsAfterDeploymentPolling } from './use-refresh-a
import { useUndeployWorkflow } from './use-undeploy-workflow'
import { toDeploymentVersion } from './version'
-function AppDeployContent({ appId }: { appId: string }) {
+function AppDeployContent({ appId, canAccessPoint }: { appId: string; canAccessPoint: boolean }) {
const { t } = useTranslation('deployments')
const { t: tCommon } = useTranslation('common')
const { t: tWorkflow } = useTranslation('workflow')
@@ -86,9 +86,10 @@ function AppDeployContent({ appId }: { appId: string }) {
</header>
<div className="flex min-h-0 grow flex-col gap-4 px-6 py-2">
- <BuiltInEnvironmentCard />
+ <BuiltInEnvironmentCard canAccessPoint={canAccessPoint} />
<EnvironmentTable
appId={appId}
+ canAccessPoint={canAccessPoint}
onDeployToEnvironment={(environment) =>
setDeploymentRequest({
environment: environment.display_name,
@@ -139,17 +140,17 @@ export default function AppDeploy() {
if (!appDetail) return <Loading type="app" />
- const canDeploy = getAppACLCapabilities(appDetail.permission_keys, {
+ const appACLCapabilities = getAppACLCapabilities(appDetail.permission_keys, {
currentUserId,
resourceMaintainer: appDetail.maintainer,
workspacePermissionKeys,
- }).canDeploy
+ })
- if (appDetail.mode !== AppModeEnum.WORKFLOW || !canDeploy) return null
+ if (appDetail.mode !== AppModeEnum.WORKFLOW || !appACLCapabilities.canDeploy) return null
return (
<AppDeployStateBoundary appId={appDetail.id}>
- <AppDeployContent appId={appDetail.id} />
+ <AppDeployContent appId={appDetail.id} canAccessPoint={appACLCapabilities.canAccessPoint} />
</AppDeployStateBoundary>
)
}
diff --git a/web/app/components/app/deploy/shared/__tests__/access-point-icon.spec.tsx b/web/app/components/app/deploy/shared/__tests__/access-point-icon.spec.tsx
new file mode 100644
index 00000000000..80d18eaaee6
--- /dev/null
+++ b/web/app/components/app/deploy/shared/__tests__/access-point-icon.spec.tsx
@@ -0,0 +1,35 @@
+import { screen } from '@testing-library/react'
+import { renderWithConsoleQuery as render } from '@/test/console/query-data'
+import { AccessPointIcon } from '../access-point-icon'
+
+describe('AccessPointIcon', () => {
+ it('links active access points when navigation is allowed', () => {
+ render(
+ <AccessPointIcon
+ accessPoint="webApp"
+ active
+ href="/app/app-1/access-point?environment=built-in&accessPoint=webApp"
+ />,
+ )
+
+ expect(screen.getByRole('link')).toHaveAttribute(
+ 'href',
+ '/app/app-1/access-point?environment=built-in&accessPoint=webApp',
+ )
+ })
+
+ it('keeps active access points visually active when navigation is not allowed', () => {
+ render(<AccessPointIcon accessPoint="webApp" active />)
+
+ expect(screen.queryByRole('link')).not.toBeInTheDocument()
+ expect(screen.getByRole('button')).toBeDisabled()
+ expect(screen.getByRole('button')).not.toHaveClass('opacity-30')
+ })
+
+ it('dims inactive access points', () => {
+ render(<AccessPointIcon accessPoint="webApp" active={false} />)
+
+ expect(screen.getByRole('button')).toBeDisabled()
+ expect(screen.getByRole('button')).toHaveClass('opacity-30')
+ })
+})
diff --git a/web/app/components/app/deploy/shared/access-point-icon.tsx b/web/app/components/app/deploy/shared/access-point-icon.tsx
index 734e9b694ee..253429f03fc 100644
--- a/web/app/components/app/deploy/shared/access-point-icon.tsx
+++ b/web/app/components/app/deploy/shared/access-point-icon.tsx
@@ -32,7 +32,7 @@ export function AccessPointIcon({
}: {
active: boolean
accessPoint: AccessPoint
- href: string
+ href?: string
}) {
const { t } = useTranslation('agentV2')
const labels = useAccessPointLabels()
@@ -40,9 +40,11 @@ export function AccessPointIcon({
? t(($) => $['agentDetail.access.status.inService'])
: t(($) => $['agentDetail.access.status.outOfService'])
const label = `${labels[accessPoint]} · ${status}`
+ const canNavigate = active && Boolean(href)
const triggerClassName = cn(
'flex size-5 shrink-0 items-center justify-center rounded-md border border-divider-regular text-text-secondary shadow-xs outline-hidden focus-visible:ring-2 focus-visible:ring-state-accent-solid',
- active ? 'cursor-pointer hover:bg-state-base-hover' : 'cursor-not-allowed opacity-30',
+ active && (canNavigate ? 'cursor-pointer hover:bg-state-base-hover' : 'cursor-default'),
+ !active && 'cursor-not-allowed opacity-30',
)
const icon = (
<span aria-hidden className={cn(ACCESS_POINT_ICON_CLASS_NAMES[accessPoint], 'size-3')} />
@@ -52,7 +54,7 @@ export function AccessPointIcon({
<Tooltip>
<TooltipTrigger
render={
- active ? (
+ active && href ? (
<Link href={href} aria-label={label} className={triggerClassName}>
{icon}
</Link>
diff --git a/web/app/components/header/account-setting/access-rules-page/permission-set-modal/__tests__/index.spec.tsx b/web/app/components/header/account-setting/access-rules-page/permission-set-modal/__tests__/index.spec.tsx
index 7c4b00da20e..764b51cb52c 100644
--- a/web/app/components/header/account-setting/access-rules-page/permission-set-modal/__tests__/index.spec.tsx
+++ b/web/app/components/header/account-setting/access-rules-page/permission-set-modal/__tests__/index.spec.tsx
@@ -19,6 +19,7 @@ const expectedAppACLPermissionKeys = [
'app.acl.tracing_config',
'app.acl.log_and_annotation',
'app.acl.access_config',
+ 'app.acl.access_point_manage',
]
const getPermissionKeyMatcher = (permissionKey: string) =>
diff --git a/web/features/home/continue-work/__tests__/item.spec.tsx b/web/features/home/continue-work/__tests__/item.spec.tsx
index ee61d10d6ce..37b74a4b944 100644
--- a/web/features/home/continue-work/__tests__/item.spec.tsx
+++ b/web/features/home/continue-work/__tests__/item.spec.tsx
@@ -168,10 +168,15 @@ describe('ContinueWorkItem', () => {
)
})
- it('should fall back to access point when RBAC is disabled for an access-config-only app', () => {
- renderItem(createApp({ permission_keys: [AppACLPermission.AccessConfig] }), {
- rbac_enabled: false,
- })
+ it('should fall back to access point when RBAC is disabled for an access-config app with access point permission', () => {
+ renderItem(
+ createApp({
+ permission_keys: [AppACLPermission.AccessConfig, AppACLPermission.AccessPoint],
+ }),
+ {
+ rbac_enabled: false,
+ },
+ )
expect(screen.getByRole('link', { name: /Continue App/ })).toHaveAttribute(
'href',
diff --git a/web/i18n/ar-TN/permission-keys.json b/web/i18n/ar-TN/permission-keys.json
index a7f129455c5..18321e3b376 100644
--- a/web/i18n/ar-TN/permission-keys.json
+++ b/web/i18n/ar-TN/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "إدارة إعدادات امتداد API",
"app.access_config": "تكوين أذونات الوصول إلى التطبيق",
"app.acl.access_config": "عرض أذونات الوصول وإدارتها",
+ "app.acl.access_point_manage": "عرض نقاط الوصول وإدارتها",
"app.acl.delete": "حذف التطبيق",
"app.acl.deploy": "نشر التطبيق",
"app.acl.edit": "تعديل معلومات التطبيق وتنسيقه",
diff --git a/web/i18n/de-DE/permission-keys.json b/web/i18n/de-DE/permission-keys.json
index fb32d92c699..2d546c0e082 100644
--- a/web/i18n/de-DE/permission-keys.json
+++ b/web/i18n/de-DE/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "API-Erweiterungskonfiguration verwalten",
"app.access_config": "App-Zugriffsberechtigungen konfigurieren",
"app.acl.access_config": "Zugriffsberechtigungen anzeigen und verwalten",
+ "app.acl.access_point_manage": "Zugangspunkte anzeigen und verwalten",
"app.acl.delete": "App löschen",
"app.acl.deploy": "App bereitstellen",
"app.acl.edit": "App-Informationen bearbeiten und App orchestrieren",
diff --git a/web/i18n/en-US/permission-keys.json b/web/i18n/en-US/permission-keys.json
index 2344caa11e1..e69f68bb0b3 100644
--- a/web/i18n/en-US/permission-keys.json
+++ b/web/i18n/en-US/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Manage API extension configuration",
"app.access_config": "Configure app access permissions",
"app.acl.access_config": "View and manage access permissions",
+ "app.acl.access_point_manage": "View and manage access points",
"app.acl.delete": "Delete app",
"app.acl.deploy": "Deploy app",
"app.acl.edit": "Edit app information and orchestrate app",
diff --git a/web/i18n/es-ES/permission-keys.json b/web/i18n/es-ES/permission-keys.json
index af3336ceea7..d7d5e9d57c8 100644
--- a/web/i18n/es-ES/permission-keys.json
+++ b/web/i18n/es-ES/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Gestionar la configuración de la extensión de API",
"app.access_config": "Configurar los permisos de acceso de la app",
"app.acl.access_config": "Ver y gestionar los permisos de acceso",
+ "app.acl.access_point_manage": "Ver y gestionar los puntos de acceso",
"app.acl.delete": "Eliminar app",
"app.acl.deploy": "Desplegar la app",
"app.acl.edit": "Editar la información y orquestar la app",
diff --git a/web/i18n/fa-IR/permission-keys.json b/web/i18n/fa-IR/permission-keys.json
index 372374ed3b8..5e739bed336 100644
--- a/web/i18n/fa-IR/permission-keys.json
+++ b/web/i18n/fa-IR/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "مدیریت پیکربندی افزونه API",
"app.access_config": "پیکربندی مجوزهای دسترسی برنامه",
"app.acl.access_config": "مشاهده و مدیریت مجوزهای دسترسی",
+ "app.acl.access_point_manage": "مشاهده و مدیریت نقاط دسترسی",
"app.acl.delete": "حذف برنامه",
"app.acl.deploy": "استقرار برنامه",
"app.acl.edit": "ویرایش اطلاعات برنامه و هماهنگ‌سازی برنامه",
diff --git a/web/i18n/fr-FR/permission-keys.json b/web/i18n/fr-FR/permission-keys.json
index 074da133fae..c547052586d 100644
--- a/web/i18n/fr-FR/permission-keys.json
+++ b/web/i18n/fr-FR/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Gérer la configuration de l'extension API",
"app.access_config": "Configurer les autorisations d'accès à l'application",
"app.acl.access_config": "Afficher et gérer les autorisations d'accès",
+ "app.acl.access_point_manage": "Afficher et gérer les points d’accès",
"app.acl.delete": "Supprimer l'application",
"app.acl.deploy": "Déployer l'application",
"app.acl.edit": "Modifier les informations et orchestrer l'application",
diff --git a/web/i18n/hi-IN/permission-keys.json b/web/i18n/hi-IN/permission-keys.json
index 314cbfba84b..0779d870342 100644
--- a/web/i18n/hi-IN/permission-keys.json
+++ b/web/i18n/hi-IN/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "API एक्सटेंशन कॉन्फ़िगरेशन प्रबंधित करें",
"app.access_config": "ऐप एक्सेस अनुमतियाँ कॉन्फ़िगर करें",
"app.acl.access_config": "एक्सेस अनुमतियाँ देखें और प्रबंधित करें",
+ "app.acl.access_point_manage": "एक्सेस पॉइंट देखें और प्रबंधित करें",
"app.acl.delete": "ऐप हटाएं",
"app.acl.deploy": "ऐप डिप्लॉय करें",
"app.acl.edit": "ऐप की जानकारी संपादित करें और ऐप को ऑर्केस्ट्रेट करें",
diff --git a/web/i18n/id-ID/permission-keys.json b/web/i18n/id-ID/permission-keys.json
index 4b04ea96f00..349bff75538 100644
--- a/web/i18n/id-ID/permission-keys.json
+++ b/web/i18n/id-ID/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Kelola konfigurasi ekstensi API",
"app.access_config": "Konfigurasikan izin akses aplikasi",
"app.acl.access_config": "Lihat dan kelola izin akses",
+ "app.acl.access_point_manage": "Lihat dan kelola titik akses",
"app.acl.delete": "Hapus aplikasi",
"app.acl.deploy": "Deploy aplikasi",
"app.acl.edit": "Edit informasi aplikasi dan orkestrasikan aplikasi",
diff --git a/web/i18n/it-IT/permission-keys.json b/web/i18n/it-IT/permission-keys.json
index 899adce084b..b5f3ebf8094 100644
--- a/web/i18n/it-IT/permission-keys.json
+++ b/web/i18n/it-IT/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Gestisci la configurazione delle estensioni API",
"app.access_config": "Configura i permessi di accesso all'app",
"app.acl.access_config": "Visualizza e gestisci i permessi di accesso",
+ "app.acl.access_point_manage": "Visualizza e gestisci i punti di accesso",
"app.acl.delete": "Elimina app",
"app.acl.deploy": "Distribuisci app",
"app.acl.edit": "Modifica le informazioni e orchestra l'app",
diff --git a/web/i18n/ja-JP/permission-keys.json b/web/i18n/ja-JP/permission-keys.json
index 1b0c567f0e8..53033e2dc10 100644
--- a/web/i18n/ja-JP/permission-keys.json
+++ b/web/i18n/ja-JP/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "API拡張設定を管理",
"app.access_config": "アプリアクセス権限を設定",
"app.acl.access_config": "アクセス権限の表示と管理",
+ "app.acl.access_point_manage": "アクセスポイントの表示と管理",
"app.acl.delete": "アプリを削除",
"app.acl.deploy": "アプリをデプロイ",
"app.acl.edit": "アプリ情報の編集とアプリのオーケストレーション",
diff --git a/web/i18n/ko-KR/permission-keys.json b/web/i18n/ko-KR/permission-keys.json
index 3a9981a602a..45517f6acb9 100644
--- a/web/i18n/ko-KR/permission-keys.json
+++ b/web/i18n/ko-KR/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "API 확장 구성 관리",
"app.access_config": "앱 접근 권한 구성",
"app.acl.access_config": "접근 권한 보기 및 관리",
+ "app.acl.access_point_manage": "액세스 지점 보기 및 관리",
"app.acl.delete": "앱 삭제",
"app.acl.deploy": "앱 배포",
"app.acl.edit": "앱 정보 편집 및 앱 오케스트레이션",
diff --git a/web/i18n/lo-LA/permission-keys.json b/web/i18n/lo-LA/permission-keys.json
index bfba51cc7e2..e04ef1f59ec 100644
--- a/web/i18n/lo-LA/permission-keys.json
+++ b/web/i18n/lo-LA/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "ຈັດການການຕັ້ງຄ່າ API extension",
"app.access_config": "ຕັ້ງຄ່າສິດການເຂົ້າເຖິງແອັບ",
"app.acl.access_config": "ເບິ່ງ ແລະ ຈັດການສິດການເຂົ້າເຖິງ",
+ "app.acl.access_point_manage": "ເບິ່ງ ແລະ ຈັດການຈຸດເຂົ້າເຖິງ",
"app.acl.delete": "ລຶບແອັບ",
"app.acl.deploy": "ຕິດຕັ້ງແອັບ",
"app.acl.edit": "ແກ້ໄຂຂໍ້ມູນແອັບ ແລະ ຈັດການລະບົບແອັບ",
diff --git a/web/i18n/nl-NL/permission-keys.json b/web/i18n/nl-NL/permission-keys.json
index 94fdf9d182c..8266b38ae22 100644
--- a/web/i18n/nl-NL/permission-keys.json
+++ b/web/i18n/nl-NL/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "API-extensieconfiguratie beheren",
"app.access_config": "Toegangsrechten voor app configureren",
"app.acl.access_config": "Toegangsrechten bekijken en beheren",
+ "app.acl.access_point_manage": "Toegangspunten bekijken en beheren",
"app.acl.delete": "App verwijderen",
"app.acl.deploy": "App implementeren",
"app.acl.edit": "App-informatie bewerken en app orkestreren",
diff --git a/web/i18n/pl-PL/permission-keys.json b/web/i18n/pl-PL/permission-keys.json
index 55619735f16..392f470914e 100644
--- a/web/i18n/pl-PL/permission-keys.json
+++ b/web/i18n/pl-PL/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Zarządzaj konfiguracją rozszerzenia API",
"app.access_config": "Konfiguruj uprawnienia dostępu do aplikacji",
"app.acl.access_config": "Wyświetlaj uprawnienia dostępu i zarządzaj nimi",
+ "app.acl.access_point_manage": "Wyświetlaj punkty dostępu i zarządzaj nimi",
"app.acl.delete": "Usuń aplikację",
"app.acl.deploy": "Wdróż aplikację",
"app.acl.edit": "Edytuj informacje o aplikacji i orkiestruj aplikację",
diff --git a/web/i18n/pt-BR/permission-keys.json b/web/i18n/pt-BR/permission-keys.json
index 32dda95b517..36dd03d5719 100644
--- a/web/i18n/pt-BR/permission-keys.json
+++ b/web/i18n/pt-BR/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Gerenciar configuração de extensão de API",
"app.access_config": "Configurar permissões de acesso ao aplicativo",
"app.acl.access_config": "Visualizar e gerenciar permissões de acesso",
+ "app.acl.access_point_manage": "Visualizar e gerenciar pontos de acesso",
"app.acl.delete": "Excluir aplicativo",
"app.acl.deploy": "Implantar aplicativo",
"app.acl.edit": "Editar informações e orquestrar o aplicativo",
diff --git a/web/i18n/ro-RO/permission-keys.json b/web/i18n/ro-RO/permission-keys.json
index 2610e185492..73225f7cd60 100644
--- a/web/i18n/ro-RO/permission-keys.json
+++ b/web/i18n/ro-RO/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Gestionează configurația extensiei API",
"app.access_config": "Configurează permisiunile de acces ale aplicației",
"app.acl.access_config": "Vizualizează și gestionează permisiunile de acces",
+ "app.acl.access_point_manage": "Vizualizează și gestionează punctele de acces",
"app.acl.delete": "Șterge aplicația",
"app.acl.deploy": "Implementează aplicația",
"app.acl.edit": "Editează informațiile aplicației și orchestrează aplicația",
diff --git a/web/i18n/ru-RU/permission-keys.json b/web/i18n/ru-RU/permission-keys.json
index 574f0e96add..bd986d65e95 100644
--- a/web/i18n/ru-RU/permission-keys.json
+++ b/web/i18n/ru-RU/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Управление конфигурацией API-расширений",
"app.access_config": "Настройка прав доступа к приложению",
"app.acl.access_config": "Просмотр и управление правами доступа",
+ "app.acl.access_point_manage": "Просмотр и управление точками доступа",
"app.acl.delete": "Удаление приложения",
"app.acl.deploy": "Развертывание приложения",
"app.acl.edit": "Редактирование информации о приложении и оркестрация приложения",
diff --git a/web/i18n/sl-SI/permission-keys.json b/web/i18n/sl-SI/permission-keys.json
index 544c6f92a8d..4a49494a2c2 100644
--- a/web/i18n/sl-SI/permission-keys.json
+++ b/web/i18n/sl-SI/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Upravljanje konfiguracije razširitve API",
"app.access_config": "Konfiguracija dovoljenj za dostop do aplikacije",
"app.acl.access_config": "Ogled in upravljanje dovoljenj za dostop",
+ "app.acl.access_point_manage": "Ogled in upravljanje dostopnih točk",
"app.acl.delete": "Izbriši aplikacijo",
"app.acl.deploy": "Uvedi aplikacijo",
"app.acl.edit": "Uredi podatke o aplikaciji in orkestriraj aplikacijo",
diff --git a/web/i18n/th-TH/permission-keys.json b/web/i18n/th-TH/permission-keys.json
index b7b9854abf0..0ad4047ef26 100644
--- a/web/i18n/th-TH/permission-keys.json
+++ b/web/i18n/th-TH/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "จัดการการกําหนดค่าส่วนขยาย API",
"app.access_config": "กําหนดค่าสิทธิ์การเข้าถึงแอป",
"app.acl.access_config": "ดูและจัดการสิทธิ์การเข้าถึง",
+ "app.acl.access_point_manage": "ดูและจัดการจุดเข้าถึง",
"app.acl.delete": "ลบแอป",
"app.acl.deploy": "ปรับใช้แอป",
"app.acl.edit": "แก้ไขข้อมูลแอปและจัดวางแอป",
diff --git a/web/i18n/tr-TR/permission-keys.json b/web/i18n/tr-TR/permission-keys.json
index 36ba8ec9709..781d9d00d38 100644
--- a/web/i18n/tr-TR/permission-keys.json
+++ b/web/i18n/tr-TR/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "API uzantısı yapılandırmasını yönet",
"app.access_config": "Uygulama erişim izinlerini yapılandır",
"app.acl.access_config": "Erişim izinlerini görüntüle ve yönet",
+ "app.acl.access_point_manage": "Erişim noktalarını görüntüle ve yönet",
"app.acl.delete": "Uygulamayı sil",
"app.acl.deploy": "Uygulamayı dağıt",
"app.acl.edit": "Uygulama bilgilerini düzenle ve uygulamayı orkestre et",
diff --git a/web/i18n/uk-UA/permission-keys.json b/web/i18n/uk-UA/permission-keys.json
index 861c83a4367..8cfd28d2548 100644
--- a/web/i18n/uk-UA/permission-keys.json
+++ b/web/i18n/uk-UA/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Керування конфігурацією розширення API",
"app.access_config": "Налаштування дозволів доступу до застосунку",
"app.acl.access_config": "Переглядати дозволи доступу та керувати ними",
+ "app.acl.access_point_manage": "Переглядати точки доступу та керувати ними",
"app.acl.delete": "Видалити застосунок",
"app.acl.deploy": "Розгорнути застосунок",
"app.acl.edit": "Редагувати інформацію про застосунок та оркеструвати застосунок",
diff --git a/web/i18n/vi-VN/permission-keys.json b/web/i18n/vi-VN/permission-keys.json
index 1e6662a9304..2290d6362e0 100644
--- a/web/i18n/vi-VN/permission-keys.json
+++ b/web/i18n/vi-VN/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "Quản lý cấu hình phần mở rộng API",
"app.access_config": "Cấu hình quyền truy cập ứng dụng",
"app.acl.access_config": "Xem và quản lý quyền truy cập",
+ "app.acl.access_point_manage": "Xem và quản lý điểm truy cập",
"app.acl.delete": "Xóa ứng dụng",
"app.acl.deploy": "Triển khai ứng dụng",
"app.acl.edit": "Chỉnh sửa thông tin và điều phối ứng dụng",
diff --git a/web/i18n/zh-Hans/permission-keys.json b/web/i18n/zh-Hans/permission-keys.json
index 91d9afb2cc8..db8184ee533 100644
--- a/web/i18n/zh-Hans/permission-keys.json
+++ b/web/i18n/zh-Hans/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "管理API扩展",
"app.access_config": "配置应用访问权限",
"app.acl.access_config": "查看与管理访问权限",
+ "app.acl.access_point_manage": "查看与管理访问点",
"app.acl.delete": "删除应用",
"app.acl.deploy": "部署应用",
"app.acl.edit": "编辑应用信息与编排应用",
diff --git a/web/i18n/zh-Hant/permission-keys.json b/web/i18n/zh-Hant/permission-keys.json
index 43350a59ada..8a74b37f086 100644
--- a/web/i18n/zh-Hant/permission-keys.json
+++ b/web/i18n/zh-Hant/permission-keys.json
@@ -3,6 +3,7 @@
"api_extension.manage": "管理API擴充配置",
"app.access_config": "配置應用訪問權限",
"app.acl.access_config": "檢視與管理存取權限",
+ "app.acl.access_point_manage": "檢視與管理存取點",
"app.acl.delete": "刪除應用",
"app.acl.deploy": "部署應用",
"app.acl.edit": "編輯應用資訊與編排應用",
diff --git a/web/utils/app-redirection.spec.ts b/web/utils/app-redirection.spec.ts
index d736ed5a428..521a500652d 100644
--- a/web/utils/app-redirection.spec.ts
+++ b/web/utils/app-redirection.spec.ts
@@ -14,12 +14,22 @@ describe('app-redirection', () => {
* - App mode (workflow, advanced-chat, chat, completion, agent-chat)
*/
describe('getRedirectionPath', () => {
- it('returns access point path when app ACL cannot access guarded pages', () => {
- const app = { id: 'app-123', mode: AppModeEnum.CHAT, permission_keys: [] }
+ it('returns access point path when app access point permission is granted', () => {
+ const app = {
+ id: 'app-123',
+ mode: AppModeEnum.CHAT,
+ permission_keys: [AppACLPermission.AccessPoint],
+ }
const result = getRedirectionPath(app)
expect(result).toBe('/app/app-123/access-point')
})
+ it('returns apps list path when app ACL cannot access guarded pages or access point', () => {
+ const app = { id: 'app-123', mode: AppModeEnum.CHAT, permission_keys: [] }
+ const result = getRedirectionPath(app)
+ expect(result).toBe('/apps')
+ })
+
it('returns workflow path for workflow mode when app ACL can access layout', () => {
const app = {
id: 'app-123',
@@ -92,7 +102,11 @@ describe('app-redirection', () => {
})
it('handles different app IDs', () => {
- const app1 = { id: 'abc-123', mode: AppModeEnum.CHAT, permission_keys: [] }
+ const app1 = {
+ id: 'abc-123',
+ mode: AppModeEnum.CHAT,
+ permission_keys: [AppACLPermission.AccessPoint],
+ }
const app2 = {
id: 'xyz-789',
mode: AppModeEnum.WORKFLOW,
@@ -129,7 +143,7 @@ describe('app-redirection', () => {
const app = {
id: 'app-123',
mode: AppModeEnum.CHAT,
- permission_keys: [AppACLPermission.AccessConfig],
+ permission_keys: [AppACLPermission.AccessConfig, AppACLPermission.AccessPoint],
}
expect(getRedirectionPath(app, { isRbacEnabled: false })).toBe('/app/app-123/access-point')
@@ -173,8 +187,12 @@ describe('app-redirection', () => {
/**
* Tests that the redirection function is called with the correct path
*/
- it('calls redirection function with access point path when app ACL cannot access guarded pages', () => {
- const app = { id: 'app-123', mode: AppModeEnum.CHAT, permission_keys: [] }
+ it('calls redirection function with access point path when access point permission is granted', () => {
+ const app = {
+ id: 'app-123',
+ mode: AppModeEnum.CHAT,
+ permission_keys: [AppACLPermission.AccessPoint],
+ }
const mockRedirect = vi.fn()
getRedirection(app, mockRedirect)
diff --git a/web/utils/app-redirection.ts b/web/utils/app-redirection.ts
index 4bdfce9a266..d73a350b3f3 100644
--- a/web/utils/app-redirection.ts
+++ b/web/utils/app-redirection.ts
@@ -34,7 +34,9 @@ export const getRedirectionPath = (
if (app.mode === AppModeEnum.WORKFLOW && appACLCapabilities.canDeploy)
return `/app/${app.id}/deploy`
- return `/app/${app.id}/access-point`
+ if (appACLCapabilities.canAccessPoint) return `/app/${app.id}/access-point`
+
+ return '/apps'
}
export const getRedirection = (
diff --git a/web/utils/permission.spec.ts b/web/utils/permission.spec.ts
index 75dff3e7afe..487c9c891b1 100644
--- a/web/utils/permission.spec.ts
+++ b/web/utils/permission.spec.ts
@@ -50,6 +50,15 @@ describe('permission', () => {
expect(releaseCapabilities.canDeploy).toBe(false)
})
+ it('keeps access point permission independent from other app ACL permissions', () => {
+ const accessPointCapabilities = getAppACLCapabilities([AppACLPermission.AccessPoint])
+ const layoutCapabilities = getAppACLCapabilities([AppACLPermission.ViewLayout])
+
+ expect(accessPointCapabilities.canAccessPoint).toBe(true)
+ expect(accessPointCapabilities.canAccessLayout).toBe(false)
+ expect(layoutCapabilities.canAccessPoint).toBe(false)
+ })
+
it('keeps monitor, tracing config, and log/annotation permissions independent', () => {
const monitorCapabilities = getAppACLCapabilities([AppACLPermission.Monitor])
const tracingCapabilities = getAppACLCapabilities([AppACLPermission.TracingConfig])
@@ -109,6 +118,7 @@ describe('permission', () => {
})
expect(capabilities.canViewLayout).toBe(true)
+ expect(capabilities.canAccessPoint).toBe(true)
expect(capabilities.canTestAndRun).toBe(true)
expect(capabilities.canEdit).toBe(true)
expect(capabilities.canImportExportDSL).toBe(true)
diff --git a/web/utils/permission.ts b/web/utils/permission.ts
index 063878b6607..30b0b3e0cbe 100644
--- a/web/utils/permission.ts
+++ b/web/utils/permission.ts
@@ -2,6 +2,7 @@ import type { PermissionKey } from '@/models/access-control'
export const AppACLPermission = {
Preview: 'app.acl.preview',
+ AccessPoint: 'app.acl.access_point_manage',
ViewLayout: 'app.acl.view_layout',
TestAndRun: 'app.acl.test_and_run',
Edit: 'app.acl.edit',
@@ -38,6 +39,7 @@ export type ResourceMaintainerPermissionOptions = {
}
type AppACLCapabilities = {
+ canAccessPoint: boolean
canViewLayout: boolean
canTestAndRun: boolean
canEdit: boolean
@@ -135,6 +137,11 @@ export const getAppACLCapabilities = (
)
return {
+ canAccessPoint: hasResourcePermission(
+ permissionKeys,
+ AppACLPermission.AccessPoint,
+ hasMaintainerPermissions,
+ ),
canViewLayout,
canTestAndRun,
canEdit,