hoangsonww/RAG-LangChain-AI-System
Feature: Multi-Workspace Tenancy with RBAC and Isolated Knowledge Bases
開放
#20 建立於 2026年3月8日
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
- Introduce workspace entities in backend (Mongo) and auth middleware that resolves
workspace_id+ role. - Enforce workspace filters in all backend routes and RAG service storage layers.
- Partition vector stores by workspace namespace/collection.
- Add workspace switcher in frontend and block cross-workspace session loading.
- 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