Repository navigation
feat(databases): share a database with the owner's team - #8603
Conversation
Why: databases could not be shared with the owner's team because the team share writer only knew documents, threads, sessions and the other shareable entities, and databases had nowhere to keep sharing state. What: - Add `database_entities.share_permission_id`, a SharePermission row made the first time the owner changes sharing; the delete trigger removes it with the entity. - Teach `share_permission_db_utils::team_share` to load and apply a database's team share, read a database without a permission row as unshared, and treat a trashed database as deleted.
Why: owners on a team had no way to give their teammates access to a database short of sharing it person by person or channel by channel. What: - The sharing service reads and writes `teamShareAccessLevel` alongside channel grants, in one transaction. - Only the actual owner may change the team share; an owner with no team gets a clear error, and a share that changed since authorization returns 409. - Teammates reach the database through a team-source `entity_access` grant, covered by a real-Postgres test.
…sure Why: CI's dependency check fails when the generated closure map lags Cargo.toml.
Why: the backend now stores a database's team share, but the share dialog only offered people and channels for databases. What: - Treat databases as team-shareable and send the team access level through the database permissions endpoint. - Regenerate the storage OpenAPI, web client, SDK and SDK docs for the team share and the new 409 response. - Describe Team access in the databases agent guide.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
… users Why: databases now call team_share, and the crate guide's Used by list left them out.
…aring # Conflicts: # crates/channels/src/outbound/channel_name/test.rs
Why
Database owners on a team couldn't give their teammates access to a
database without adding them one person or one channel at a time. Split
out of #8367 so the Notion import PR keeps only import code. #8367 stacks
on this migration and keeps its exact version.
How it works
The team share uses the same
share_permission_db_utils::team_sharewriter as documents, threads and sessions. A database gets a
SharePermissionrow (database_entities.share_permission_id) the firsttime its owner changes sharing. Its grant is a team-source
entity_accessrow, so rows, listing and Soup read it like any other grant.
What
20261021183145_database_team_sharing.sql: adds theshare_permission_idcolumn. The delete trigger now removes thedatabase's sharing settings along with the entity.
share_permission_db_utils: accepts databases. A database with nopermission row reads as unshared, and a trashed database counts as
deleted.
databases: the sharing service reads and writesteamShareAccessLevelin the same transaction as channel grants. Onlythe actual owner can change it, an owner with no team gets a clear
error, and a share that changed since authorization returns 409.
Includes a real-Postgres teammate access test.
database permissions endpoint.
the databases agent guide and
crates/databases/AGENTS.md.