Phase 13, part 8: a team's data is theirs

The owner exports everything from Settings → Your data (the keys only with
their password), and can delete the team: it closes at once, everyone in it
is told, it can be undone for 30 days, and then its schema, files, agents
and memberships go for good.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 12:40:28 -07:00
co-authored by Claude Opus 5.5
parent d35ed7cbb2
commit b8a64e258a
11 changed files with 501 additions and 4 deletions
+9 -1
View File
@@ -179,7 +179,7 @@ func (s *Server) forTeam(team int64) (*Server, error) {
cp.Team, cp.DB, cp.Secrets = team, d, sec
cp.Platform = s.platform()
if s.Files != nil {
cp.Files = storage.Under(s.Files, fmt.Sprintf("teams/%d", team))
cp.Files = storage.Under(s.Files, teamFilesPrefix(team))
}
st.mu.Lock()
defer st.mu.Unlock()
@@ -331,6 +331,12 @@ func (s *Server) Handler() (http.Handler, error) {
// Signing in (the server edition).
mux.HandleFunc("GET /setup/{token}", (*Server).setupPage)
mux.HandleFunc("POST /setup/{token}", (*Server).setupSave)
mux.HandleFunc("GET /settings/data", (*Server).dataPage)
mux.HandleFunc("POST /settings/data/export", (*Server).dataExport)
mux.HandleFunc("GET /settings/data/exports/{name}", (*Server).dataDownload)
mux.HandleFunc("POST /settings/data/exports/{name}/delete", (*Server).dataExportDelete)
mux.HandleFunc("POST /settings/data/delete-team", (*Server).teamDelete)
mux.HandleFunc("POST /teams/undelete", (*Server).teamUndelete)
mux.HandleFunc("GET /platform", (*Server).platformPage)
mux.HandleFunc("POST /platform/stop-viewing", (*Server).platformStopViewing)
mux.HandleFunc("POST /platform/teams/{id}/{action}", (*Server).platformAction)
@@ -925,6 +931,8 @@ var flashes = map[string]string{
"domain-proved": "Proved: the domain is the team's.",
"team-suspended": "Suspended: its people see that it is, and its work waits.",
"team-restored": "Restored.",
"exported": "Exported: %d rows. Download it below.",
"undeleted": "The team won't be deleted: it's back as it was.",
"domain-released": "Released: another team can prove the domain now.",
"invitations-resent": "Sent %d invitations again.",
"view-needs-reason": "Give a reason and how long: it's recorded in the team's own log.",