Enforce self-or-owner on an account, not just the org boundary

FixBillingService
Shipped
August 9, 2026 at 3:10 AM UTC
Author
Kamo
Commit
60831b9

Follow-up to the cross-org gate, now that the rule is decided: inside an organization you may manage your own billing account, and an organization owner may manage anyone in that organization. Nobody else can. That is exactly what the Plans and Billing tab already shows — it renders on "isSelf || teamMember.isOrganizationOwner" — but the rule lived only in the UI, so the server happily served a colleague any account in the same org. No legitimate user sees a change; the screen already behaved this way. Own-ness is the account primary member or an AccountMember row. Ownership is resolved through the JPQL team-member lookup rather than instanceof on findById(Member), because JOINED inheritance can hand back a Member proxy that fails the cast even when the row is a team member — the trap PlatformAdminInterceptor documents. Deliberately not gated on MANAGE_ORG_FINANCES: that right is currently granted to nobody, so requiring it would have locked every member out of their own subscription. 10 tests on the gate, 92 pass overall.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing