dify/api/tests/unit_tests/services/enterprise
Jyong cce0d818cf feat(knowledge-fs): authorize spaces with the legacy dataset RBAC points
KnowledgeFS spaces used their own `knowledge_space_*` RBAC vocabulary, so
workspace roles configured for knowledge bases did not apply to them. Reuse
the legacy `dataset_*` permission points instead, following the mapping the
dataset console already applies:

- read      -> dataset_readonly
- create    -> dataset_create_and_management
- edit / document write -> dataset_edit
- delete    -> dataset_delete
- access config -> dataset_access_config
- query / research / trace detail -> dataset_retrieval_recall

The enterprise `/knowledge-fs/permission-keys/batch` lookup now answers in
that vocabulary and is translated back into the product capabilities the
console exposes as `permission_keys`, so the web stays unchanged; the
historical `knowledge_space_*` keys remain accepted during the transition.
Workspace-level checks send the mapped dataset scene with
`resource_type=dataset`, and the RBAC-disabled fallback grants every dataset
point KnowledgeFS consults.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-03 11:10:04 -04:00
..
__init__.py feat: inject traceparent in enterprise api (#30895) 2026-01-13 23:37:39 +09:00
test_account_deletion_sync.py refactor(api): move account lifecycle into application services (#40438) 2026-08-21 08:05:43 +00:00
test_app_permitted_service.py feat: adding dify cli (#36348) 2026-05-26 01:12:36 +00:00
test_enterprise_service.py refactor(api): extract web app access queries (#40482) 2026-08-19 10:34:36 +00:00
test_plugin_manager_service.py chore: rm all mock_logger (#37786) 2026-06-24 07:10:02 +00:00
test_rbac_service.py feat(knowledge-fs): authorize spaces with the legacy dataset RBAC points 2026-09-03 11:10:04 -04:00
test_traceparent_propagation.py test(api): add autospec to MagicMock-based patch usage (#32752) 2026-03-01 04:30:45 +08:00