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:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user