Skip to content

Commit

Permalink
Merge pull request #180 from bcgov/re-enable-role-guards
Browse files Browse the repository at this point in the history
reenable role guards
  • Loading branch information
mgtennant authored Apr 30, 2024
2 parents 201defc + d15227d commit 0a1e9da
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions backend/src/admin/admin.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down
4 changes: 2 additions & 2 deletions backend/src/report/report.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/app/content/display/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<header className="header">
Expand Down

0 comments on commit 0a1e9da

Please sign in to comment.