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:
1 parent
cdbdaedb8f
commit
c510304813
7 files changed
+43
-30
No files matched your search
@@ -8,8 +8,7 @@ import {
|
||||
Query,
|
||||
} 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 { CreateBottlingBatchDto } from './dto/create-bottling-batch.dto';
|
||||
@@ -22,17 +21,19 @@ import { BottlingService } from './bottling.service';
|
||||
export class BottlingController {
|
||||
constructor(private readonly bottlingService: BottlingService) {}
|
||||
|
||||
@RequirePermission('bottling:read')
|
||||
@Get()
|
||||
findAll(@Query('honeyBatchId') honeyBatchId?: string) {
|
||||
return this.bottlingService.findAll({ honeyBatchId });
|
||||
}
|
||||
|
||||
@RequirePermission('bottling:read')
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.bottlingService.findById(id);
|
||||
}
|
||||
|
||||
@Roles(Role.ADMIN, Role.BEEKEEPER)
|
||||
@RequirePermission('bottling:create')
|
||||
@Post()
|
||||
create(
|
||||
@Body() dto: CreateBottlingBatchDto,
|
||||
@@ -41,7 +42,7 @@ export class BottlingController {
|
||||
return this.bottlingService.create(dto, actor.id);
|
||||
}
|
||||
|
||||
@Roles(Role.ADMIN, Role.BEEKEEPER)
|
||||
@RequirePermission('bottling:update')
|
||||
@Patch(':id')
|
||||
update(
|
||||
@Param('id') id: string,
|
||||
|
||||
Reference in new issue
Block a user