hoangsonww/RAG-LangChain-AI-System

Feature: Multi-Workspace Tenancy with RBAC and Isolated Knowledge Bases

开放

#20 创建于 2026年3月8日

 (0 条评论) (0 个反应) (1 位负责人)Jupyter Notebook (13 个派生)auto 404
bugdocumentationenhancementgood first issuehelp wantedquestion

仓库指标

星标
 (46 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Summary

Add first-class multi-workspace support so one deployment can safely serve multiple portfolio teams with strict data isolation, RBAC, and workspace-scoped retrieval/session state.

Why this matters

The current platform behaves like a single-tenant system. For real adoption across multiple investor teams, we need tenant boundaries so data, sessions, and retrieval context never leak between workspaces.

Scope

  • Workspace model (workspace, membership, role).
  • Role-based access control (owner, editor, viewer) for API and frontend actions.
  • Workspace-scoped data isolation for:
    • chat sessions
    • vector indexes / collections
    • cached responses
    • ingestion jobs
  • Workspace context propagation through request lifecycle and backend tool calls.
  • Audit trail for high-risk actions (ingest, delete, reindex, export).

Non-goals

  • Full enterprise SSO implementation in this issue (can be follow-up).
  • Billing/plan management.

Proposed implementation

  1. Introduce workspace entities in backend (Mongo) and auth middleware that resolves workspace_id + role.
  2. Enforce workspace filters in all backend routes and RAG service storage layers.
  3. Partition vector stores by workspace namespace/collection.
  4. Add workspace switcher in frontend and block cross-workspace session loading.
  5. Add request-level policy checks and structured audit logs.

Acceptance criteria

  • Users can belong to multiple workspaces and switch context in UI.
  • Every chat, retrieval, and ingestion request is bound to one workspace.
  • Cross-workspace reads/writes are blocked at API and storage layers.
  • Role restrictions are enforced for ingestion, deletion, and admin operations.
  • Automated tests cover authorization matrix and isolation guarantees.
  • Audit events are emitted with actor, workspace, action, and target.

Dependencies / sequencing

  • Should align with API modularization work but is not blocked on full FastAPI migration.

Labels

enhancement, security, backend, frontend

贡献者指南