dify/api/tests/unit_tests
kota-maeda0708 c232375fd2 feat: add visibility control for plugin datasource credentials
Plugin-based datasource credentials (Notion, Jina, Firecrawl, etc.) were
implicitly shared with every workspace member. PR #35468 added the
visibility column, creator tracking and read-side filtering for datasource
providers, but left no way to actually set or change a credential's scope,
so every datasource credential stayed effectively all_team_members.

This completes the datasource side:

Backend:
- add_datasource_api_key_provider / add_datasource_oauth_provider accept
  user_id and visibility; API keys default to all_team_members, OAuth
  defaults to only_me (matching the plugin-credential philosophy)
- new update_datasource_credential_visibility (+ console endpoint) so the
  creator can switch between only_me / all_team_members / partial_members;
  only the creator (or legacy NULL-owner rows) may change the scope
- replace_partial_member_list / clear_partial_member_list helpers on
  CredentialPermissionService (caller owns the transaction)
- list_datasource_credentials returns visibility, user_id, is_editable and
  partial_member_list

Frontend:
- VisibilityModal reusing PermissionSelector, with an empty-partial-members
  guard (the backend rejects an empty list)
- "Who can use" action in the credential operator, gated on is_editable
- scope badges (only me / partial team members) on the credential item

Existing credentials keep working: the visibility column defaults to
all_team_members and legacy rows with a NULL owner are always visible.
2026-06-25 00:00:40 +09:00
..
clients feat(agent-v2): sync nightly updates to main (2026-06-22) (#37651) 2026-06-23 08:05:16 +00:00
commands chore: add Type to test (#37191) 2026-06-19 16:44:20 +00:00
configs fix(api): add bounded timeouts to Nacos remote settings HTTP requests (#37444) 2026-06-16 07:42:51 +00:00
controllers refactor(tests): use caplog in web login tests (#37889) 2026-06-24 14:44:01 +00:00
core feat: surface separated-mode LLM reasoning in CLI and workflow run preview (#37828) 2026-06-24 08:02:28 +00:00
enterprise/telemetry chore: rm all mock_logger (#37786) 2026-06-24 07:10:02 +00:00
enums refactor: quota v3 integration (#35436) 2026-04-27 01:49:40 +00:00
events chore: rm all mock_logger (#37786) 2026-06-24 07:10:02 +00:00
extensions chore: rm all mock_logger (#37786) 2026-06-24 07:10:02 +00:00
factories fix: validate conversation variable description length to prevent varchar(255) truncation error (#33038) 2026-06-10 07:28:12 +00:00
fields feat(chatflow): stream LLM reasoning to a live thinking panel (#37460) 2026-06-23 09:49:01 +00:00
libs fix: correct misleading password length validation message (#37796) 2026-06-23 09:00:16 +00:00
migrations feat(agent-v2): sync nightly updates to main (2026-06-22) (#37651) 2026-06-23 08:05:16 +00:00
models chore: not use request.scoped session (#37421) 2026-06-22 19:38:24 +00:00
oss chore: add more type in test (#37609) 2026-06-18 23:07:12 +00:00
repositories feat(api): introduce select, file and file list form input types to Human Input node (#36322) 2026-06-04 01:54:28 +00:00
services feat: add visibility control for plugin datasource credentials 2026-06-25 00:00:40 +09:00
tasks chore: Caplog type (#37603) 2026-06-18 18:53:13 +00:00
tools chore: reorg imports (#35308) 2026-04-16 08:50:02 +00:00
utils chore: add Type to test (#37191) 2026-06-19 16:44:20 +00:00
__init__.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
.gitignore Enhance Code Consistency Across Repository with .editorconfig (#19023) 2025-04-29 18:04:33 +08:00
conftest.py chore: fix use select style api in orm (#35531) 2026-04-24 08:35:20 +00:00
test_makefile_backend_tests.py test(api): manage backend pytest services natively (#36235) 2026-05-19 07:52:15 +00:00
test_pytest_dify.py test(api): manage backend pytest services natively (#36235) 2026-05-19 07:52:15 +00:00