feat(connections): tenant-wide connection sharing — admin provisions, all use - #1018
Conversation
… all use (#901) Connections gain a visibility flag (private | shared): - shared connections are first-class queryable for every tenant user (query route fast path) and visible in the connections list and schema/databases introspection — creators no longer need their own copy of every credential - credentials never leave the server for anyone; the owner id is exposed only as an isOwner boolean - visibility changes are admin-only and owner-scoped (admins share connections they own — the 'admin provisions' model) - non-owners see shared connections read-only: no edit/delete/test/ share menu at all - ConnectionCard gains a Shared badge and a visibility toggle item (pure UI props, no business logic in the component package) Migration 0008 adds the enum column (default private — no behavior change for existing rows). E2E: connection-sharing.spec walks the full lifecycle — private invisibility, admin share, creator read-only view + direct query, non-admin toggle rejection (403), unshare dropping the creator back to dashboard-bound access (403 via #972). Per the 2026-06-11 overnight charter decision: 'Admin provisions, all use'. Closes #901 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (13)
WalkthroughThis PR implements Option B from issue ChangesConnection visibility and tenant sharing
Sequence Diagram(s)sequenceDiagram
participant Admin as Admin (ALICE)
participant NonOwner as Non-owner (BOB)
participant UI
participant API as GET /api/connections
participant DB
Admin->>UI: private connection created
NonOwner->>API: list connections (tenantId=T)
API->>DB: where (userId=BOB or visibility="shared") and tenantId=T
DB-->>API: [] (connection not shared yet)
API-->>NonOwner: empty list
Admin->>UI: click "Share with workspace"
UI->>API: PATCH /api/connections/[id] {visibility: "shared"}
API->>DB: UPDATE visibility="shared" where id=X
DB-->>API: OK
NonOwner->>API: list connections (tenantId=T)
API->>DB: where (userId=BOB or visibility="shared") and tenantId=T
DB-->>API: [{id, visibility: "shared", ownerId: ALICE_ID}]
API->>API: isOwner = (ALICE_ID === BOB) = false
API-->>NonOwner: [{id, visibility: "shared", isOwner: false}]
NonOwner->>UI: shows "Shared" badge, read-only
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



What
Closes #901 (charter decision: admin provisions, all use — the Metabase/Superset/Looker model).
Today every creator must own a copy of every connection, meaning admins hand out database credentials. This PR adds a
visibilityflag (private|shared) so an admin can share a connection workspace-wide: everyone in the tenant can query it and build dashboards on it, while credentials never leave the server and management stays owner/admin-only.Behavior
isOwnerflag, never the owner id)ConnectionCardgains a Shared badge + visibility-toggle menu item (pure UI props — component package stays logic-free)private→ zero behavior change for existing rowsTests
connection-sharing.spec.ts(5 serial E2E tests): private invisibility → admin shares via card menu → creator sees read-only card with badge + queries directly (200) → creator PATCH rejected (403) → admin un-shares and creator's arbitrary query falls to dashboard-bound 403 ([P1] security: /api/query dashboard fallback allows arbitrary read queries against any referenced connection #972)Verification
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes