Skip to content

Commit

Permalink
Merge pull request #1994 from bcgov/hotfix/ALCS-2396
Browse files Browse the repository at this point in the history
HOTFIX: allow all roles but commissioner to fetch tags
  • Loading branch information
trslater authored Nov 21, 2024
2 parents 8b799c9 + 7014e3e commit abd1303
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ApiOAuth2 } from '@nestjs/swagger';
import * as config from 'config';
import { RolesGuard } from '../../../common/authorization/roles-guard.service';
import { UserRoles } from '../../../common/authorization/roles.decorator';
import { AUTH_ROLE } from '../../../common/authorization/roles';
import { ANY_ROLE_BUT_COMMISSIONER, AUTH_ROLE } from '../../../common/authorization/roles';
import { TagCategoryDto } from './tag-category.dto';
import { TagCategoryService } from './tag-category.service';

Expand All @@ -14,7 +14,7 @@ export class TagCategoryController {
constructor(private service: TagCategoryService) {}

@Get('')
@UserRoles(AUTH_ROLE.ADMIN)
@UserRoles(...ANY_ROLE_BUT_COMMISSIONER)
async fetch(
@Query('pageIndex') pageIndex: number,
@Query('itemsPerPage') itemsPerPage: number,
Expand Down
4 changes: 2 additions & 2 deletions services/apps/alcs/src/alcs/tag/tag.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as config from 'config';
import { RolesGuard } from '../../common/authorization/roles-guard.service';
import { UserRoles } from '../../common/authorization/roles.decorator';
import { TagService } from './tag.service';
import { AUTH_ROLE } from '../../common/authorization/roles';
import { ANY_ROLE_BUT_COMMISSIONER, AUTH_ROLE } from '../../common/authorization/roles';
import { TagDto } from './tag.dto';

@Controller('tag')
Expand All @@ -14,7 +14,7 @@ export class TagController {
constructor(private service: TagService) {}

@Get('')
@UserRoles(AUTH_ROLE.ADMIN)
@UserRoles(...ANY_ROLE_BUT_COMMISSIONER)
async fetch(
@Query('pageIndex') pageIndex: number,
@Query('itemsPerPage') itemsPerPage: number,
Expand Down
11 changes: 3 additions & 8 deletions services/apps/alcs/src/common/authorization/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ export const ROLES_ALLOWED_APPLICATIONS = [
];

export const ROLES_ALLOWED_BOARDS = ROLES_ALLOWED_APPLICATIONS;
export const ROLES_ALLOWED_ARCHIVE = [
AUTH_ROLE.ADMIN,
AUTH_ROLE.APP_SPECIALIST,
];
export const ROLES_ALLOWED_ARCHIVE = [AUTH_ROLE.ADMIN, AUTH_ROLE.APP_SPECIALIST];
export const ANY_AUTH_ROLE = Object.values(AUTH_ROLE);
export const ROLES_ALLOWED_SEARCH = [
...ROLES_ALLOWED_APPLICATIONS,
AUTH_ROLE.COMMISSIONER,
];
export const ROLES_ALLOWED_SEARCH = [...ROLES_ALLOWED_APPLICATIONS, AUTH_ROLE.COMMISSIONER];
export const ANY_ROLE_BUT_COMMISSIONER = Object.values(AUTH_ROLE).filter((role) => role !== AUTH_ROLE.COMMISSIONER);

0 comments on commit abd1303

Please sign in to comment.