Phase 14, part 1: plans, each team's account, and their limits

The multi-tenant edition's plans (Free and Paid as decided, or a plans
file) and each team's billing account, with a 14-day trial of Paid. A
team's plan caps what its people and agents may change: modules outside it
stay readable, a lapsed team changes nothing, and agents, Market entries,
crawls and background jobs keep to it. Without a Stripe key, no billing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 13:15:00 -07:00
co-authored by Claude Opus 5.5
parent e47764a78e
commit a47990f9bf
19 changed files with 848 additions and 7 deletions
+9
View File
@@ -104,6 +104,9 @@ type Membership struct {
User int64
Role Role
Modules map[string]Access // a member's; admins and owners have them all
// Cap limits every role, admins too: a module missing from it can't be
// reached, one at View only read (the team's plan). nil: no cap.
Cap map[string]Access
}
// Admin says whether the role runs the whole system.
@@ -112,6 +115,12 @@ func (m Membership) Admin() bool { return m.Role == Owner || m.Role == Admin }
// Can says whether the member may see a module (write false) or change
// things in it (write true).
func (m Membership) Can(module string, write bool) bool {
if m.Cap != nil {
c, ok := m.Cap[module]
if !ok || (write && c != Edit) {
return false
}
}
if m.Admin() {
return true
}