diff --git a/backend/ebios_rm/models.py b/backend/ebios_rm/models.py index 044c6bc49..3473f896f 100644 --- a/backend/ebios_rm/models.py +++ b/backend/ebios_rm/models.py @@ -230,6 +230,9 @@ class Pertinence(models.IntegerChoices): is_selected = models.BooleanField(verbose_name=_("Is selected"), default=False) justification = models.TextField(verbose_name=_("Justification"), blank=True) + def __str__(self) -> str: + return f"{self.get_risk_origin_display()} - {self.target_objective}" + class Meta: verbose_name = _("RO/TO couple") verbose_name_plural = _("RO/TO couples") @@ -322,6 +325,9 @@ class Meta: verbose_name_plural = _("Stakeholders") ordering = ["created_at"] + def __str__(self): + return f"{self.entity.name} - {self.get_category_display()}" + def save(self, *args, **kwargs): self.folder = self.ebios_rm_study.folder super().save(*args, **kwargs) diff --git a/backend/ebios_rm/serializers.py b/backend/ebios_rm/serializers.py index 4b5a0d9d2..4ce91514d 100644 --- a/backend/ebios_rm/serializers.py +++ b/backend/ebios_rm/serializers.py @@ -139,6 +139,8 @@ class AttackPathReadSerializer(BaseModelSerializer): folder = FieldsRelatedField() ro_to_couple = FieldsRelatedField() stakeholders = FieldsRelatedField(many=True) + risk_origin = serializers.CharField(source="ro_to_couple.get_risk_origin_display") + target_objective = serializers.CharField(source="ro_to_couple.target_objective") class Meta: model = AttackPath diff --git a/backend/ebios_rm/views.py b/backend/ebios_rm/views.py index 8fcaf6ce9..833a576f9 100644 --- a/backend/ebios_rm/views.py +++ b/backend/ebios_rm/views.py @@ -101,6 +101,10 @@ def pertinence(self, request): class StakeholderViewSet(BaseModelViewSet): model = Stakeholder + filterset_fields = [ + "ebios_rm_study", + ] + @action(detail=False, name="Get category choices") def category(self, request): return Response(dict(Stakeholder.Category.choices)) @@ -109,6 +113,10 @@ def category(self, request): class AttackPathViewSet(BaseModelViewSet): model = AttackPath + filterset_fields = [ + "ebios_rm_study", + ] + class OperationalScenarioViewSet(BaseModelViewSet): model = OperationalScenario diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 0da5fd9e2..931583238 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -955,6 +955,7 @@ "fairlyRelevant": "Fairly relevant", "highlyRelevant": "Highly relevant", "roTo": "RO/TO", + "roToCouple": "RO/TO couple", "addRoto": "Add RO/TO couple", "organizedCrime": "Organized crime", "terrorist": "Terrorist", @@ -962,5 +963,19 @@ "professional": "Professional", "amateur": "Amateur", "avenger": "Avenger", - "pathological": "Pathological" + "pathological": "Pathological", + "currentDependency": "Current dependency", + "currentPenetration": "Current penetration", + "currentMaturity": "Current maturity", + "currentTrust": "Current trust", + "residualDependency": "Residual dependency", + "residualPenetration": "Residual penetration", + "residualMaturity": "Residual maturity", + "residualTrust": "Residual trust", + "selected": "Selected", + "likelihood": "Likelihood", + "stakeholders": "Stakeholders", + "addAttackPath": "Add attack path", + "currentCriticality": "Current criticality", + "residualCriticality": "Residual criticality" } diff --git a/frontend/src/lib/components/Forms/ModelForm.svelte b/frontend/src/lib/components/Forms/ModelForm.svelte index 3866c9d84..e0398bbe8 100644 --- a/frontend/src/lib/components/Forms/ModelForm.svelte +++ b/frontend/src/lib/components/Forms/ModelForm.svelte @@ -29,6 +29,8 @@ import EbiosRmForm from './ModelForm/EbiosRmForm.svelte'; import FearedEventForm from './ModelForm/FearedEventForm.svelte'; import RoToForm from './ModelForm/RoToForm.svelte'; + import StakeholderForm from './ModelForm/StakeholderForm.svelte'; + import AttackPathForm from './ModelForm/AttackPathForm.svelte'; import AutocompleteSelect from './AutocompleteSelect.svelte'; @@ -264,6 +266,10 @@ {:else if URLModel === 'ro-to'} + {:else if URLModel === 'stakeholders'} + + {:else if URLModel === 'attack-paths'} + {/if}
{#if closeModal} diff --git a/frontend/src/lib/components/Forms/ModelForm/AttackPathForm.svelte b/frontend/src/lib/components/Forms/ModelForm/AttackPathForm.svelte new file mode 100644 index 000000000..321ce2e8c --- /dev/null +++ b/frontend/src/lib/components/Forms/ModelForm/AttackPathForm.svelte @@ -0,0 +1,50 @@ + + +