Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX - ajout du droit de création de bilan pour les conseillers et les validateurs dans le front #2856

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading