fix(web): gate staff-only Convex queries to avoid RBAC errors on dashboard and tickets; docs: add desktop agent history and troubleshooting

This commit is contained in:
Esdras Renan 2025-10-10 01:11:03 -03:00
parent 7685370c05
commit ab820ddeca
11 changed files with 144 additions and 33 deletions

View file

@ -33,12 +33,13 @@ function formatScore(value: number | null) {
}
export function SectionCards() {
const { session, convexUserId } = useAuth()
const { session, convexUserId, isStaff } = useAuth()
const tenantId = session?.user.tenantId ?? DEFAULT_TENANT_ID
const dashboardEnabled = Boolean(isStaff && convexUserId)
const dashboard = useQuery(
api.reports.dashboardOverview,
convexUserId ? { tenantId, viewerId: convexUserId as Id<"users"> } : "skip"
dashboardEnabled ? { tenantId, viewerId: convexUserId as Id<"users"> } : "skip"
)
const trendInfo = useMemo(() => {