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
@@ -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 { CreateExtractionDto } from './dto/create-extraction.dto';
|
||||
@@ -14,17 +13,19 @@ import { ExtractionsService } from './extractions.service';
|
||||
export class ExtractionsController {
|
||||
constructor(private readonly extractionsService: ExtractionsService) {}
|
||||
|
||||
@RequirePermission('extractions:read')
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.extractionsService.findAll();
|
||||
}
|
||||
|
||||
@RequirePermission('extractions:read')
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.extractionsService.findById(id);
|
||||
}
|
||||
|
||||
@Roles(Role.ADMIN, Role.BEEKEEPER)
|
||||
@RequirePermission('extractions:create')
|
||||
@Post()
|
||||
create(
|
||||
@Body() dto: CreateExtractionDto,
|
||||
@@ -33,7 +34,7 @@ export class ExtractionsController {
|
||||
return this.extractionsService.create(dto, actor.id);
|
||||
}
|
||||
|
||||
@Roles(Role.ADMIN, Role.BEEKEEPER)
|
||||
@RequirePermission('extractions:update')
|
||||
@Patch(':id')
|
||||
update(
|
||||
@Param('id') id: string,
|
||||
|
||||
Reference in new issue
Block a user