fix(03): resolve tenant context for module activation

Controller now falls back to user.tenantId from JWT when
req.tenantId is null (SUPER_ADMIN without x-tenant-id header).
Also added error display to admin modules page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 14:38:37 +02:00
parent dad9a779df
commit b8ef870d1a
2 changed files with 16 additions and 5 deletions
@@ -46,7 +46,7 @@ export class ModuleRegistryController {
*/
@Get('active')
async findActive(@Req() req: Request) {
const tenantId = (req as any).tenantId;
const tenantId = (req as any).tenantId ?? (req as any).user?.tenantId;
if (!tenantId) {
throw new ForbiddenException('No tenant context');
}
@@ -66,7 +66,7 @@ export class ModuleRegistryController {
@Param('moduleId') moduleId: string,
@Req() req: Request,
) {
const tenantId = (req as any).tenantId;
const tenantId = (req as any).tenantId ?? (req as any).user?.tenantId;
if (!tenantId) {
throw new ForbiddenException('No tenant context');
}
@@ -85,7 +85,7 @@ export class ModuleRegistryController {
@Param('moduleId') moduleId: string,
@Req() req: Request,
) {
const tenantId = (req as any).tenantId;
const tenantId = (req as any).tenantId ?? (req as any).user?.tenantId;
if (!tenantId) {
throw new ForbiddenException('No tenant context');
}