Rep-level analytics privacy

The analytics endpoint enforces its own visibility: admins and owners see the org, sales managers see their configured team, a plain rep sees only their own leads, and crew roles are refused.

What it is

A server-side scope decision made before any data is read, not a UI filter. The response tells the panel which scope it got ('all', 'team' or 'own'), and the panel adapts — a rep on 'own' scope never even renders the leaderboard or group-compare sections.

Also called: reps only see their own leads · sales manager visibility · who can see analytics

See it
Rep-level analytics privacy
Won
38%
Avg cycle
18d
Pipeline
$407k
JanSep
The Analytics subtitle rendering 'Showing your own leads.' for a rep, with the Leaderboard and Group Compare sections absent. Header + conditional sections in AnalyticsView.tsx. Sample data — no customer information appears here.
How it works
  1. 1Admin or tenant owner → org-wide.
  2. 2Anyone else → the effective lead-visibility scope is looked up; 'team' resolves to a configured id set that already includes self, 'own' resolves to self only.
  3. 3A team or own scope with no identities fails closed to a sentinel id that matches nothing.
  4. 4Requested rep ids are intersected with the allowed set, so a crafted request can never widen access.
  5. 5crew_lead and worker roles get a 403 outright.
Why we built it

The route header spells it out — it 'enforces its OWN per-rep lead visibility (it does NOT route through /api/db)'. The underlying visibility module states the failure mode: 'Fails CLOSED: any lookup error degrades to "own" (the most restrictive non-admin scope), never to "all".'

The problem
  • Reporting endpoints are a classic back door around record-level permissions.
  • A lookup failure that defaulted open would leak the whole book.
Sound familiar?
What you get
A rep gets genuinely useful analytics on their own book without seeing anyone else's leads.
Access can only ever narrow, never widen, from a crafted request.

See it on your own jobs

Twenty minutes, your numbers, no slide deck. We’ll build one of your real buildings in front of you and send you the estimate link at the end — yours to keep either way.

or keep browsing features →