mirror of
https://github.com/langgenius/dify.git
synced 2026-10-04 13:47:55 +08:00
feat(rbac): agent RBAC/ACL scenes and resource-locator check bundles (#41768)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
60e983c493
commit
86134ea99e
152 files changed
+5360
-3405
No files matched your search
@@ -464,7 +464,7 @@ const ownerWorkspacePermissionKeys = [
|
||||
'dataset.external.connect',
|
||||
'tool.manage',
|
||||
'mcp.manage',
|
||||
'agent.manage',
|
||||
'agent.acl.preview',
|
||||
'skill.view',
|
||||
]
|
||||
|
||||
@@ -750,10 +750,12 @@ describe('MainNav', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('hides the roster entry when the user lacks agent.manage', () => {
|
||||
it('hides the roster entry when the user lacks agent.acl.preview', () => {
|
||||
mockConsoleState.current = {
|
||||
...consoleState,
|
||||
workspacePermissionKeys: ownerWorkspacePermissionKeys.filter((key) => key !== 'agent.manage'),
|
||||
workspacePermissionKeys: ownerWorkspacePermissionKeys.filter(
|
||||
(key) => key !== 'agent.acl.preview',
|
||||
),
|
||||
}
|
||||
|
||||
renderMainNav()
|
||||
@@ -761,7 +763,7 @@ describe('MainNav', () => {
|
||||
expect(screen.queryByRole('link', { name: /Agents/ })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('shows the roster entry when the user has agent.manage', () => {
|
||||
it('shows the roster entry when the user has agent.acl.preview', () => {
|
||||
renderMainNav()
|
||||
|
||||
expect(screen.getByRole('link', { name: /Agents/ })).toBeInTheDocument()
|
||||
@@ -898,7 +900,7 @@ describe('MainNav', () => {
|
||||
isCurrentWorkspaceEditor: false,
|
||||
isCurrentWorkspaceManager: false,
|
||||
isCurrentWorkspaceOwner: false,
|
||||
workspacePermissionKeys: ['app_library.access', 'tool.manage', 'agent.manage'],
|
||||
workspacePermissionKeys: ['app_library.access', 'tool.manage', 'agent.acl.preview'],
|
||||
}
|
||||
|
||||
renderMainNav({ branding: { enabled: false } })
|
||||
|
||||
@@ -63,7 +63,7 @@ describe('AgentSelectorContent', () => {
|
||||
mocks.agents = []
|
||||
})
|
||||
|
||||
it('offers the Agent Console link with agent.manage', async () => {
|
||||
it('offers the Agent Console link with agent.acl.preview', async () => {
|
||||
await renderSelector({ onStartFromScratch: vi.fn() })
|
||||
|
||||
const listbox = screen.getByRole('listbox')
|
||||
@@ -99,7 +99,7 @@ describe('AgentSelectorContent', () => {
|
||||
expect(listbox.querySelector('.overflow-y-auto')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('hides the Agent Console link without agent.manage', async () => {
|
||||
it('hides the Agent Console link without agent.acl.preview', async () => {
|
||||
mocks.canManageAgents = false
|
||||
|
||||
await renderSelector()
|
||||
@@ -107,7 +107,7 @@ describe('AgentSelectorContent', () => {
|
||||
expect(screen.queryByText(manageInConsoleLabel)).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('keeps start from scratch without agent.manage', async () => {
|
||||
it('keeps start from scratch without agent.acl.preview', async () => {
|
||||
mocks.canManageAgents = false
|
||||
|
||||
await renderSelector({ onStartFromScratch: vi.fn() })
|
||||
|
||||
Reference in new issue
Block a user