feat(15-05): getWidgets filters via ModuleAccessService (D-22, PERM-07)
- DashboardModule imports ModuleRegistryModule to inject ModuleAccessService - getWidgets(userId, tenantId, role) runs the existing findMany unchanged first, then calls getAccessibleModuleIds exactly once — only if a loaded widget's type is in WIDGET_MODULE_MAP (currently always empty, so no lookup runs today); unresolved module slugs fail closed - DashboardController.getWidgets forwards tenantId + role from the JWT - dashboard.service.spec.ts (8 tests, TDD-GREEN): covers every <behavior> case incl. D-03 ADMIN bypass, adjacency/empty/ordering/idempotency, and fail-closed on an unresolved Module slug - pnpm --filter @tessera/api test: 457/457 green; type-check clean - manual e2e against local API + DB container: empty WIDGET_MODULE_MAP leaves an existing user's widget count unchanged (2/2 clock+search survived the filter), throwaway verification user/rows removed after
This commit is contained in:
@@ -68,8 +68,9 @@ export class DashboardController {
|
||||
|
||||
@Get('widgets')
|
||||
async getWidgets(@Req() req: Request) {
|
||||
const { userId } = this.extractContext(req);
|
||||
return this.dashboardService.getWidgets(userId);
|
||||
const { userId, tenantId } = this.extractContext(req);
|
||||
const role = (req as any).user?.role;
|
||||
return this.dashboardService.getWidgets(userId, tenantId, role);
|
||||
}
|
||||
|
||||
@Post('widgets')
|
||||
|
||||
Reference in New Issue
Block a user