Service Layer medium complexity backend
0
Dependencies
0
Dependents
7
Entities
0
Integrations

Description

Utility service that translates a user's role and organizational memberships into a concrete data scope key used to scope all report queries. Integrates with the role-based access control system to ensure coordinators cannot query data outside their assigned scope.

Feature: Coordinator Reports & Dashboards

report-scope-resolver

Responsibilities

  • Resolve user's organizational scope from user_organization_memberships and user_roles tables
  • Generate cache-compatible scope keys for result caching
  • Validate that requested scope is within the user's permitted access level

Interfaces

resolveScope(userId: string): Promise<OrgScope>
buildScopeKey(scope: OrgScope, filters: FilterSet): string
validateScopeAccess(userId: string, requestedScope: OrgScope): Promise<boolean>
getScopeHierarchy(scopeKey: string): Promise<ScopeHierarchy>