fix: scope barcode template permissions to specific endpoints instead of the entire controller
Build and Push Multi-Platform Images / build-and-push (push) Successful in 26s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 26s
This commit is contained in:
@@ -72,7 +72,6 @@ function validate(dto: UpsertDto, partial = false): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Controller('api/barcode-templates')
|
@Controller('api/barcode-templates')
|
||||||
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
|
||||||
export class BarcodeTemplatesController {
|
export class BarcodeTemplatesController {
|
||||||
private readonly logger = new Logger(BarcodeTemplatesController.name);
|
private readonly logger = new Logger(BarcodeTemplatesController.name);
|
||||||
|
|
||||||
@@ -89,11 +88,13 @@ export class BarcodeTemplatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
|
@RequirePermissions(Permission.VIEW_INBOX)
|
||||||
async list() {
|
async list() {
|
||||||
return this.repo.find({ order: { Id: 'ASC' } });
|
return this.repo.find({ order: { Id: 'ASC' } });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
|
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
||||||
async create(@Body() dto: UpsertDto) {
|
async create(@Body() dto: UpsertDto) {
|
||||||
validate(dto);
|
validate(dto);
|
||||||
const entity = this.repo.create({
|
const entity = this.repo.create({
|
||||||
@@ -118,6 +119,7 @@ export class BarcodeTemplatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id')
|
@Put(':id')
|
||||||
|
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
||||||
async update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpsertDto) {
|
async update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpsertDto) {
|
||||||
validate(dto, true);
|
validate(dto, true);
|
||||||
const existing = await this.repo.findOneBy({ Id: id });
|
const existing = await this.repo.findOneBy({ Id: id });
|
||||||
@@ -149,6 +151,7 @@ export class BarcodeTemplatesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@RequirePermissions(Permission.MANAGE_SETTINGS)
|
||||||
async remove(@Param('id', ParseIntPipe) id: number) {
|
async remove(@Param('id', ParseIntPipe) id: number) {
|
||||||
const res = await this.repo.delete(id);
|
const res = await this.repo.delete(id);
|
||||||
if (!res.affected) throw new NotFoundException('Vorlage nicht gefunden');
|
if (!res.affected) throw new NotFoundException('Vorlage nicht gefunden');
|
||||||
|
|||||||
Reference in New Issue
Block a user