dify/web/service/knowledge
yungle246 be6612f454 feat: allow knowledge base API keys to be scoped to a single dataset
Reintroduce the nullable api_tokens.dataset_id column (dropped in 2e9819ca5b28)
so dataset API keys can opt into per-knowledge-base scoping:

- NULL dataset_id keeps today's workspace-wide behavior, so every existing key
  and the existing /datasets/api-keys create route are unchanged.
- validate_dataset_token rejects a bound key for any other dataset, and for
  endpoints that carry no dataset id (e.g. list-all), with 403.
- CachedApiToken carries dataset_id with a None default so cache entries
  written before deploy keep deserializing.
- The per-dataset console routes in apikey.py (previously dead code that 500ed
  on a missing ApiToken.dataset_id) now create bound keys; their list returns
  bound keys plus workspace keys so the dataset page shows the full access
  picture.
- Frontend: the knowledge base API access popover gains an API keys entry; the
  secret key modal accepts datasetId, shows a scope column, and offers a
  workspace / this-knowledge-base scope choice on create. New strings are
  localized for all 23 locales.
2026-06-11 11:41:47 +09:00
..
use-create-dataset.ts chore: enable noUncheckedIndexedAccess (#35178) 2026-04-16 13:01:35 +00:00
use-dataset.spec.ts fix: redirect unauthorized dataset access to /datasets for knowledge editors (#36073) 2026-05-12 09:38:49 +00:00
use-dataset.ts feat: allow knowledge base API keys to be scoped to a single dataset 2026-06-11 11:41:47 +09:00
use-document.ts chore: knip fix (#34481) 2026-04-02 15:03:42 +00:00
use-hit-testing.ts chore: knip fix (#34481) 2026-04-02 15:03:42 +00:00
use-import.ts chore(web): new lint setup (#30020) 2025-12-23 16:58:55 +08:00
use-metadata.spec.tsx chore(web): new lint setup (#30020) 2025-12-23 16:58:55 +08:00
use-metadata.ts chore: knip fix (#34481) 2026-04-02 15:03:42 +00:00
use-segment.ts chore: integrate @tanstack/eslint-plugin-query and fix service layer lint errors (#30444) 2026-01-04 11:20:06 +08:00