major fixes
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// GET /api/billing/capabilities — effective plan ∩ global features for the active company.
|
||||
// GET /api/billing/capabilities — effective plan ∩ global ∩ member features for the caller.
|
||||
func (s *Server) handleGetCapabilities(w http.ResponseWriter, r *http.Request) {
|
||||
if s.Billing == nil {
|
||||
Error(w, http.StatusServiceUnavailable, "billing unavailable")
|
||||
@@ -22,7 +22,10 @@ func (s *Server) handleGetCapabilities(w http.ResponseWriter, r *http.Request) {
|
||||
Error(w, http.StatusUnauthorized, "company required")
|
||||
return
|
||||
}
|
||||
caps, err := s.Billing.CapabilitiesForCompany(r.Context(), cid)
|
||||
// Member-aware: the company owner's per-member overlay narrows what this caller
|
||||
// sees, so nav / route guard / feature gates all hide the same surfaces at once.
|
||||
uid, _ := UserIDFromContext(r.Context())
|
||||
caps, err := s.Billing.CapabilitiesForMember(r.Context(), cid, uid)
|
||||
if err != nil {
|
||||
Error(w, http.StatusInternalServerError, "failed to load capabilities")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user