feat: RBAC Phase 2c - Ernte & Lager auf @RequirePermission umgestellt

Harvests, Extractions, HoneyBatches, Storage, Products, Bottling,
Equipment: @Roles(...) durch @RequirePermission(...) ersetzt,
ungeschuetzte GET-Routen mit :read-Rechten geschlossen. HoneyBatches
behaelt die feine Unterscheidung relocate (auch STAFF) vs.
create/measurements (nur BEEKEEPER+); Storage bekommt konsequent
keine STAFF-Schreibrechte (deckt sich mit dem bisherigen @Roles-Stand).

Verifiziert: tsc, lint, volle e2e-Suite 158/159 gruen (1 getrackter Skip).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Sonnet 5 committed 2026-08-26 07:05:32 +02:00
1 parent cdbdaedb8f
commit c510304813
7 files changed
+43 -30

No files matched your search

@@ -1,7 +1,6 @@
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { LegacyRole as Role } from '../../generated/prisma';
import { Roles } from '../auth/decorators/roles.decorator';
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 { CreateHarvestDto } from './dto/create-harvest.dto';
@@ -14,17 +13,19 @@ import { HarvestsService } from './harvests.service';
export class HarvestsController {
constructor(private readonly harvestsService: HarvestsService) {}
@RequirePermission('harvests:read')
@Get()
findAll() {
return this.harvestsService.findAll();
}
@RequirePermission('harvests:read')
@Get(':id')
findOne(@Param('id') id: string) {
return this.harvestsService.findById(id);
}
@Roles(Role.ADMIN, Role.BEEKEEPER, Role.STAFF)
@RequirePermission('harvests:create')
@Post()
create(
@Body() dto: CreateHarvestDto,
@@ -33,7 +34,7 @@ export class HarvestsController {
return this.harvestsService.create(dto, actor.id);
}
@Roles(Role.ADMIN, Role.BEEKEEPER, Role.STAFF)
@RequirePermission('harvests:update')
@Patch(':id')
update(
@Param('id') id: string,