Users, Webhooks, Automation, Import, AuditLog: die klassenweiten @Roles(Role.ADMIN)-Blankets (die gefaehrlichsten der Migration, da sie JEDE Route der Klasse abdecken) durch pro-Route @RequirePermission ersetzt. Effektiver Zugriff unveraendert: ADMIN besitzt weiterhin alle betroffenen Permission-Keys, jede andere Rolle bleibt ausgeschlossen. Damit ist kein @Roles(...) mehr in der Codebase in Benutzung - alle 23 Controller laufen jetzt vollstaendig ueber @RequirePermission. test/authorization-coverage.e2e-spec.ts (bisher it.skip mit TODO fuer "nach Phase 2") ist jetzt scharf geschaltet und bestaetigt: 0 Routen ohne Rechte-Pruefung, 0 ungueltige Permission-Keys. Verifiziert: tsc, lint, build, unit (222/222), volle e2e-Suite 159/159 gruen - keine uebersprungenen Tests mehr. Co-Authored-By: Claude Sonnet 5 <[email protected]>
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { Body, Controller, Get, Param, Patch } from '@nestjs/common';
|
|
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
|
import { RequirePermission } from '../auth/decorators/require-permission.decorator';
|
|
import { CurrentUser } from '../auth/decorators/current-user.decorator';
|
|
import type { AuthenticatedUser } from '../auth/types/authenticated-user';
|
|
import { AutomationService } from './automation.service';
|
|
import { UpdateAutomationRuleDto } from './dto/update-automation-rule.dto';
|
|
|
|
@ApiTags('automation-rules')
|
|
@ApiBearerAuth()
|
|
@Controller('automation-rules')
|
|
export class AutomationController {
|
|
constructor(private readonly automationService: AutomationService) {}
|
|
|
|
@RequirePermission('automation:read')
|
|
@Get()
|
|
findAll() {
|
|
return this.automationService.findAll();
|
|
}
|
|
|
|
@RequirePermission('automation:update')
|
|
@Patch(':id')
|
|
update(
|
|
@Param('id') id: string,
|
|
@Body() dto: UpdateAutomationRuleDto,
|
|
@CurrentUser() actor: AuthenticatedUser,
|
|
) {
|
|
return this.automationService.update(id, dto, actor.id);
|
|
}
|
|
}
|