Skip to content

Commit

Permalink
- fix role
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo Herrera authored and Eduardo Herrera committed Jun 26, 2023
1 parent aed04eb commit f840788
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createMemoryHistory } from 'history';

import Claims from '@/constants/claims';
import { Roles } from '@/constants/index';
import {
getMockApiCompensation,
getMockApiCompensationPayee,
Expand Down Expand Up @@ -136,7 +137,7 @@ describe('Compensation Detail View Component', () => {
it('Admin user should be able to Edit Compensation when is in "FINAL" status', async () => {
const mockFinalCompensation = getMockApiFinalCompensation();
const { queryByTitle } = await setup({
claims: [Claims.ADMIN_USERS],
roles: [Roles.SYSTEM_ADMINISTRATOR],
props: { compensation: mockFinalCompensation },
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Section } from '@/components/common/Section/Section';
import { SectionField } from '@/components/common/Section/SectionField';
import { StyledSummarySection } from '@/components/common/Section/SectionStyles';
import { StyledAddButton } from '@/components/common/styles';
import { Claims } from '@/constants';
import { Claims, Roles } from '@/constants';
import useKeycloakWrapper from '@/hooks/useKeycloakWrapper';
import { Api_CompensationPayee } from '@/models/api/CompensationPayee';
import { Api_CompensationRequisition } from '@/models/api/CompensationRequisition';
Expand Down Expand Up @@ -55,7 +55,7 @@ export const CompensationRequisitionDetailView: React.FunctionComponent<
setEditMode,
onGenerate,
}) => {
const { hasClaim } = useKeycloakWrapper();
const { hasClaim, hasRole } = useKeycloakWrapper();
const getPayeeDetails = (
compensationPayee: Api_CompensationPayee | null | undefined,
): PayeeViewDetails | null => {
Expand Down Expand Up @@ -124,7 +124,7 @@ export const CompensationRequisitionDetailView: React.FunctionComponent<
return true;
}

if (!compensation.isDraft && hasClaim(Claims.ADMIN_USERS)) {
if (!compensation.isDraft && hasRole(Roles.SYSTEM_ADMINISTRATOR)) {
return true;
}

Expand Down

0 comments on commit f840788

Please sign in to comment.