Skip to content

Commit

Permalink
add assessment right in front for counsellors and validators
Browse files Browse the repository at this point in the history
  • Loading branch information
bbohec committed Jan 22, 2025
1 parent d68b8e4 commit 1e3bbe5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion front/src/app/pages/immersion-assessment/AssessmentPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { Alert } from "@codegouvfr/react-dsfr/Alert";
import React from "react";
import { Loader, MainWrapper, PageHeader } from "react-design-system";
import {
AssessmentRole,
ConventionJwtPayload,
assessmentRoles,
decodeMagicLinkJwtWithoutSignatureCheck,
} from "shared";
import { Breadcrumbs } from "src/app/components/Breadcrumbs";
Expand Down Expand Up @@ -31,7 +33,7 @@ export const AssessmentPage = ({ route }: AssessmentPageProps) => {
});
const canCreateAssessment = convention?.status === "ACCEPTED_BY_VALIDATOR";

const hasRight = role === "establishment-tutor";
const hasRight = assessmentRoles.includes(role as AssessmentRole);

if (fetchConventionError)
return (
Expand Down
7 changes: 7 additions & 0 deletions shared/src/role/role.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type SignatoryRole = (typeof allSignatoryRoles)[number];
export type AgencyModifierRole = (typeof agencyModifierRoles)[number];
export type ModifierRole = (typeof allModifierRoles)[number];
export type EstablishmentRole = (typeof establishmentsRoles)[number];
export type AssessmentRole = (typeof assessmentRoles)[number];
export const allRoles = [
"beneficiary",
"beneficiary-representative",
Expand Down Expand Up @@ -40,6 +41,12 @@ export const allModifierRoles = [
...agencyModifierRoles,
] as const;

export const assessmentRoles = [
"establishment-tutor",
"validator",
"counsellor",
] as const;

export const getRequesterRole = (roles: Role[]): Role => {
if (roles.includes("back-office")) return "back-office";
if (roles.includes("validator")) return "validator";
Expand Down

0 comments on commit 1e3bbe5

Please sign in to comment.