From cfd276f31b1c2d42d3ec201186983cf91f2e48dd Mon Sep 17 00:00:00 2001 From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com> Date: Tue, 19 Jan 2021 14:39:17 +0100 Subject: [PATCH] fix(guard) : fix class name --- src/structures/structures.controller.ts | 4 ++-- .../guards/{isOwner.guard.ts => isStructureOwner.guard.ts} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/users/guards/{isOwner.guard.ts => isStructureOwner.guard.ts} (88%) diff --git a/src/structures/structures.controller.ts b/src/structures/structures.controller.ts index 78b45a4d5..bea00579d 100644 --- a/src/structures/structures.controller.ts +++ b/src/structures/structures.controller.ts @@ -1,7 +1,7 @@ import { Body, Controller, Get, Param, ParseIntPipe, Post, Put, Query, UseGuards } from '@nestjs/common'; import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard'; import { Roles } from '../users/decorators/roles.decorator'; -import { IsOwnerGuard } from '../users/guards/isOwner.guard'; +import { IsStructureOwnerGuard } from '../users/guards/isStructureOwner.guard'; import { User } from '../users/schemas/user.schema'; import { UsersService } from '../users/users.service'; import { CreateStructureDto } from './dto/create-structure.dto'; @@ -25,7 +25,7 @@ export class StructuresController { } @Put(':id') - @UseGuards(JwtAuthGuard, IsOwnerGuard) + @UseGuards(JwtAuthGuard, IsStructureOwnerGuard) @Roles('admin') public async update(@Param('id') id: string, @Body() body: structureDto): Promise<Structure> { return this.structureService.update(id, body); diff --git a/src/users/guards/isOwner.guard.ts b/src/users/guards/isStructureOwner.guard.ts similarity index 88% rename from src/users/guards/isOwner.guard.ts rename to src/users/guards/isStructureOwner.guard.ts index d112d3f0e..5c1de520b 100644 --- a/src/users/guards/isOwner.guard.ts +++ b/src/users/guards/isStructureOwner.guard.ts @@ -4,7 +4,7 @@ import { User } from '../schemas/user.schema'; import { RolesGuard } from './roles.guard'; @Injectable() -export class IsOwnerGuard extends RolesGuard implements CanActivate { +export class IsStructureOwnerGuard extends RolesGuard implements CanActivate { constructor(protected readonly reflector: Reflector) { super(reflector); } -- GitLab