Skip to content

Add AnalyticsAdminGuard restricting sensitive endpoints #551

Description

@phertyameen

Description

Add a guard (following the pattern of backend/src/roles/roles.guard.ts) that only allows users with an admin/staff role to access sensitive analytics endpoints (churn-risk, exports, raw event listing).

Why this matters

Analytics data can reveal individual user behavior; not all endpoints should be reachable by regular authenticated users.

Files to touch

  • backend/src/analytics/guards/analytics-admin.guard.ts
  • backend/src/roles/roles.decorator.ts

Acceptance Criteria

  • Non-admin users receive a 403 on guarded routes
  • Admin users pass through normally
  • Guard is unit tested with both allow and deny cases

Notes

This issue is part of the new analytics module effort (tracking, aggregation,
and reporting on player/game activity). Please keep new code inside
backend/src/analytics/ following the same module/controller/service/provider
layout used by existing modules (e.g. progress, streak, quests).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions