From d15227d0c0028001e01181d3c861cdabfca2d888 Mon Sep 17 00:00:00 2001 From: mgtennant <100305096+mgtennant@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:15:47 -0700 Subject: [PATCH] reenable role guards --- backend/src/admin/admin.controller.ts | 4 ++-- backend/src/report/report.controller.ts | 4 ++-- frontend/src/app/content/display/Header.tsx | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/backend/src/admin/admin.controller.ts b/backend/src/admin/admin.controller.ts index 01751676..c6c3b2a2 100644 --- a/backend/src/admin/admin.controller.ts +++ b/backend/src/admin/admin.controller.ts @@ -35,8 +35,8 @@ let requestConfig: AxiosRequestConfig; @Controller('admin') @UseGuards(JwtAuthGuard) -// @UseGuards(JwtRoleGuard) -// @Roles(Role.TICDI_ADMIN) +@UseGuards(JwtRoleGuard) +@Roles(Role.TICDI_ADMIN) export class AdminController { constructor(private readonly adminService: AdminService) { const hostname = process.env.backend_url ? process.env.backend_url : `http://localhost`; diff --git a/backend/src/report/report.controller.ts b/backend/src/report/report.controller.ts index 48b5f329..d17f72d4 100644 --- a/backend/src/report/report.controller.ts +++ b/backend/src/report/report.controller.ts @@ -80,8 +80,8 @@ export class ReportController { // remember to update @Post('generate-report') - // @UseGuards(JwtRoleGuard) - // @Roles(Role.GENERATE_DOCUMENTS) + @UseGuards(JwtRoleGuard) + @Roles(Role.GENERATE_DOCUMENTS) @Header('Content-Type', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') @Header('Content-Disposition', 'attachment; filename=report.docx') async generateReport( diff --git a/frontend/src/app/content/display/Header.tsx b/frontend/src/app/content/display/Header.tsx index 7acf44d1..5fd288fd 100644 --- a/frontend/src/app/content/display/Header.tsx +++ b/frontend/src/app/content/display/Header.tsx @@ -4,8 +4,7 @@ import UserService from '../../service/user-service'; const Header: FC = () => { const username = UserService.getUsername(); - // const isAdmin = UserService.hasRole([Roles.TICDI_ADMIN]); - const isAdmin = true; + const isAdmin = UserService.hasRole([Roles.TICDI_ADMIN]); return (