Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
error in the matrix name translation

remove default matrix value for ebios-rm
This was a false good idea, as it bypasses the selection of matrices by governance body.
  • Loading branch information
eric-intuitem committed Dec 21, 2024
1 parent a12f7ce commit ab9fbae
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 32 deletions.
26 changes: 26 additions & 0 deletions backend/ebios_rm/migrations/0010_alter_ebiosrmstudy_risk_matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 5.1.4 on 2024-12-21 18:37

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("core", "0046_riskassessment_ebios_rm_study"),
("ebios_rm", "0009_alter_roto_activity"),
]

operations = [
migrations.AlterField(
model_name="ebiosrmstudy",
name="risk_matrix",
field=models.ForeignKey(
blank=True,
help_text="Risk matrix used as a reference for the study",
on_delete=django.db.models.deletion.PROTECT,
related_name="ebios_rm_studies",
to="core.riskmatrix",
verbose_name="Risk matrix",
),
),
]
4 changes: 1 addition & 3 deletions backend/ebios_rm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ class Status(models.TextChoices):
on_delete=models.PROTECT,
verbose_name=_("Risk matrix"),
related_name="ebios_rm_studies",
help_text=_(
"Risk matrix used as a reference for the study. Defaults to `urn:intuitem:risk:library:risk-matrix-4x4-ebios-rm`"
),
help_text=_("Risk matrix used as a reference for the study"),
blank=True,
)
assets = models.ManyToManyField(
Expand Down
22 changes: 0 additions & 22 deletions backend/ebios_rm/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,6 @@ class EbiosRMStudyWriteSerializer(BaseModelSerializer):
queryset=RiskMatrix.objects.all(), required=False
)

def create(self, validated_data):
if not validated_data.get("risk_matrix"):
try:
ebios_matrix = RiskMatrix.objects.filter(
urn="urn:intuitem:risk:matrix:risk-matrix-4x4-ebios-rm"
).first()
if not ebios_matrix:
ebios_matrix_library = StoredLibrary.objects.get(
urn="urn:intuitem:risk:library:risk-matrix-4x4-ebios-rm"
)
ebios_matrix_library.load()
ebios_matrix = RiskMatrix.objects.get(
urn="urn:intuitem:risk:matrix:risk-matrix-4x4-ebios-rm"
)
validated_data["risk_matrix"] = ebios_matrix
except (StoredLibrary.DoesNotExist, RiskMatrix.DoesNotExist) as e:
logging.error(f"Error loading risk matrix: {str(e)}")
raise serializers.ValidationError(
"An error occurred while loading the risk matrix."
)
return super().create(validated_data)

class Meta:
model = EbiosRMStudy
exclude = ["created_at", "updated_at"]
Expand Down
3 changes: 2 additions & 1 deletion backend/library/libraries/risk-matrix-4x4-ebios-rm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ref_id: risk-matrix-4x4-ebios-rm
name: 4x4 risk matrix from EBIOS-RM
description: based on the official guide of the EBIOS RM approach
copyright: public domain
version: 2
version: 3
provider: intuitem
packager: intuitem
translations:
Expand Down Expand Up @@ -171,4 +171,5 @@ objects:
- 2
translations:
fr:
name: Matrice 4x4 EBIOS-RM
description: "Bas\xE9e sur le guide officiel de la m\xE9thode EBIOS RM"
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
cacheLock={cacheLocks['risk_matrix']}
bind:cachedValue={formDataCache['risk_matrix']}
label={m.riskMatrix()}
placeholder={m.ebiosRmRiskMatrix()}
placeholder={m.riskAssessmentMatrixHelpText()}
helpText={m.ebiosRmMatrixHelpText()}
/>
{:else if context === 'ebiosRmStudy'}
Expand Down
3 changes: 1 addition & 2 deletions frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@
"ebiosWs5_4": "Assess and document residual risks",
"ebiosWs5_5": "Establish risk monitoring framework",
"activity": "Step",
"ebiosRmMatrixHelpText": "Risk matrix used as a reference for the study. Defaults to `urn:intuitem:risk:library:risk-matrix-4x4-ebios-rm`",
"ebiosRmMatrixHelpText": "Risk matrix used as a reference for the study",
"activityOne": "Step 1",
"activityTwo": "Step 2",
"activityThree": "Step 3",
Expand Down Expand Up @@ -1014,7 +1014,6 @@
"addStrategicScenario": "Add strategic scenario",
"markAsDone": "Mark as done",
"markAsInProgress": "Mark as in progress",
"ebiosRmRiskMatrix": "4x4 risk matrix from EBIOS-RM",
"riskAnalyses": "Risk analyses",
"client": "Client",
"partner": "Partner",
Expand Down
2 changes: 1 addition & 1 deletion frontend/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@
"ebiosWs5_4": "Évaluer et documenter les risques résiduels",
"ebiosWs5_5": "Mettre en place le cadre de suivi des risques",
"activity": "Activité",
"ebiosRmMatrixHelpText": "Matrice de risque utilisée pour l'étude. La valeur par défaut est `urn:intuitem:risk:library:risk-matrix-4x4-ebios-rm`",
"ebiosRmMatrixHelpText": "Matrice de risque utilisée pour l'étude.",
"activityOne": "Activité 1",
"activityTwo": "Activité 2",
"activityThree": "Activité 3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
cacheLock={cacheLocks['risk_matrix']}
bind:cachedValue={formDataCache['risk_matrix']}
label={m.riskMatrix()}
placeholder={m.ebiosRmRiskMatrix()}
helpText={m.ebiosRmMatrixHelpText()}
/>
{:else if context === 'ebiosRmStudy'}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/utils/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export const ebiosRMSchema = z.object({
...NameDescriptionMixin,
version: z.string().optional().default('0.1'),
ref_id: z.string().optional().default(''),
risk_matrix: z.string().optional(),
risk_matrix: z.string(),
authors: z.array(z.string().optional()).optional(),
reviewers: z.array(z.string().optional()).optional(),
observation: z.string().optional().nullable(),
Expand Down
Binary file modified tools/matrix/risk-matrix-4x4-ebios-rm.xlsx
Binary file not shown.

0 comments on commit ab9fbae

Please sign in to comment.