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:
Xiyuan Chenandautofix-ci[bot] authored and GitHub committed 2026-09-07 04:39:43 +00:00
1 parent 60e983c493
commit 86134ea99e
152 files changed
+5360 -3405

No files matched your search

@@ -8,13 +8,16 @@ function PermissionProbe() {
describe('useCanManageAgents', () => {
it.each([
[['agent.manage'], 'true'],
[['agent.acl.preview'], 'true'],
[['dataset.create_and_management'], 'false'],
])('resolves agent.manage from the current permission snapshot', (permissionKeys, expected) => {
const { wrapper } = createConsoleQueryWrapper({ workspacePermissionKeys: permissionKeys })
])(
'resolves agent.acl.preview from the current permission snapshot',
(permissionKeys, expected) => {
const { wrapper } = createConsoleQueryWrapper({ workspacePermissionKeys: permissionKeys })
render(<PermissionProbe />, { wrapper })
render(<PermissionProbe />, { wrapper })
expect(screen.getByText(expected)).toBeInTheDocument()
})
expect(screen.getByText(expected)).toBeInTheDocument()
},
)
})
+2 -2
View File
@@ -4,10 +4,10 @@ import { useAtomValue } from 'jotai'
import { workspacePermissionKeysAtom } from '@/context/permission-state'
import { hasPermission } from '@/utils/permission'
const AGENT_MANAGE_PERMISSION_KEY = 'agent.manage'
const AGENT_PREVIEW_PERMISSION_KEY = 'agent.acl.preview'
export const useCanManageAgents = () => {
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
return hasPermission(workspacePermissionKeys, AGENT_MANAGE_PERMISSION_KEY)
return hasPermission(workspacePermissionKeys, AGENT_PREVIEW_PERMISSION_KEY)
}