diff --git a/backend/core/serializers.py b/backend/core/serializers.py index 1b2661a14..f61807a06 100644 --- a/backend/core/serializers.py +++ b/backend/core/serializers.py @@ -705,3 +705,13 @@ class FilteringLabelWriteSerializer(BaseModelSerializer): class Meta: model = FilteringLabel exclude = ["folder", "is_published"] + + +class QualificationReadSerializer(ReferentialSerializer): + class Meta: + model = Qualification + exclude = ["translations"] + + +class QualificationWriteSerializer(QualificationReadSerializer): + pass diff --git a/backend/core/startup.py b/backend/core/startup.py index 833cff177..63d952859 100644 --- a/backend/core/startup.py +++ b/backend/core/startup.py @@ -363,6 +363,10 @@ "view_operationalscenario", "change_operationalscenario", "delete_operationalscenario", + "view_qualification", + "add_qualification", + "change_qualification", + "delete_qualification", ] THIRD_PARTY_RESPONDENT_PERMISSIONS_LIST = [ diff --git a/backend/core/urls.py b/backend/core/urls.py index d0aa4054d..a1a1ab108 100644 --- a/backend/core/urls.py +++ b/backend/core/urls.py @@ -66,6 +66,11 @@ FilteringLabelViewSet, basename="filtering-labels", ) +router.register( + r"qualifications", + QualificationViewSet, + basename="qualifications", +) ROUTES = settings.ROUTES MODULES = settings.MODULES.values() diff --git a/backend/core/views.py b/backend/core/views.py index be431f545..334d74198 100644 --- a/backend/core/views.py +++ b/backend/core/views.py @@ -359,7 +359,13 @@ class AssetViewSet(BaseModelViewSet): """ model = Asset - filterset_fields = ["folder", "parent_assets", "type", "risk_scenarios"] + filterset_fields = [ + "folder", + "parent_assets", + "type", + "risk_scenarios", + "ebios_rm_studies", + ] search_fields = ["name", "description", "business_value"] @action(detail=False, name="Get type choices") @@ -1950,6 +1956,15 @@ def post(self, request, *args, **kwargs): return Response(status=status.HTTP_400_BAD_REQUEST) +class QualificationViewSet(BaseModelViewSet): + """ + API endpoint that allows qualifications to be viewed or edited. + """ + + model = Qualification + search_fields = ["name"] + + class ComplianceAssessmentViewSet(BaseModelViewSet): """ API endpoint that allows compliance assessments to be viewed or edited. diff --git a/backend/ebios_rm/migrations/0001_initial.py b/backend/ebios_rm/migrations/0001_initial.py index 66af48c5f..8980b23f0 100644 --- a/backend/ebios_rm/migrations/0001_initial.py +++ b/backend/ebios_rm/migrations/0001_initial.py @@ -163,6 +163,7 @@ class Migration(migrations.Migration): related_name="ebios_rm_studies", to="core.riskmatrix", verbose_name="Risk matrix", + blank=True, ), ), ], diff --git a/backend/ebios_rm/models.py b/backend/ebios_rm/models.py index 99104508d..f51d4fc8b 100644 --- a/backend/ebios_rm/models.py +++ b/backend/ebios_rm/models.py @@ -31,6 +31,7 @@ class Status(models.TextChoices): help_text=_( "Risk matrix used as a reference for the study. Defaults to `urn:intuitem:risk:library:risk-matrix-4x4-ebios-rm`" ), + blank=True, ) assets = models.ManyToManyField( Asset, diff --git a/backend/ebios_rm/serializers.py b/backend/ebios_rm/serializers.py index 3507bf69f..39dfdd6f7 100644 --- a/backend/ebios_rm/serializers.py +++ b/backend/ebios_rm/serializers.py @@ -65,8 +65,8 @@ class Meta: class FearedEventReadSerializer(BaseModelSerializer): - str = serializers.CharField(source="__str__") ebios_rm_study = FieldsRelatedField() + qualifications = FieldsRelatedField(["name"], many=True) folder = FieldsRelatedField() class Meta: diff --git a/backend/ebios_rm/views.py b/backend/ebios_rm/views.py index 69676bf77..7bdfa29f3 100644 --- a/backend/ebios_rm/views.py +++ b/backend/ebios_rm/views.py @@ -27,3 +27,7 @@ def status(self, request): class FearedEventViewSet(BaseModelViewSet): model = FearedEvent + + filterset_fields = [ + "ebios_rm_study", + ] diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 8be7b78d0..d16cc46f7 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -919,5 +919,11 @@ "ebiosWs5_3": "Define security measures", "ebiosWs5_4": "Assess and document residual risks", "ebiosWs5_5": "Establish risk monitoring framework", - "activity": "Activity" + "activity": "Activity", + "ebiosRmMatrixHelpText": "Risk matrix used as a reference for the study. Defaults to `urn:intuitem:risk:library:risk-matrix-4x4-ebios-rm`", + "activityOne": "Activity 1", + "activityTwo": "Activity 2", + "ebiosRmStudy": "Ebios RM study", + "qualifications": "Qualifications", + "impacts": "Impacts" } diff --git a/frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte b/frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte index 7ceac4475..ff92026a7 100644 --- a/frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte +++ b/frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte @@ -17,7 +17,7 @@ let tokenPath = ''; crumbs = tokens.map((t) => { tokenPath += '/' + t; - if (t === $breadcrumbObject.id) { + if (t === $breadcrumbObject?.id) { if ($breadcrumbObject.name) { t = $breadcrumbObject.name; } else if ($breadcrumbObject.first_name && $breadcrumbObject.last_name) { diff --git a/frontend/src/lib/components/Forms/ModelForm.svelte b/frontend/src/lib/components/Forms/ModelForm.svelte index 2a331686a..054b51a71 100644 --- a/frontend/src/lib/components/Forms/ModelForm.svelte +++ b/frontend/src/lib/components/Forms/ModelForm.svelte @@ -26,6 +26,8 @@ import SsoSettingsForm from './ModelForm/SsoSettingForm.svelte'; import FolderForm from './ModelForm/FolderForm.svelte'; import GeneralSettingsForm from './ModelForm/GeneralSettingForm.svelte'; + import EbiosRmForm from './ModelForm/EbiosRmForm.svelte'; + import FearedEventForm from './ModelForm/FearedEventForm.svelte'; import AutocompleteSelect from './AutocompleteSelect.svelte'; @@ -254,6 +256,10 @@ {:else if URLModel === 'filtering-labels'} + {:else if URLModel === 'ebios-rm'} + + {:else if URLModel === 'feared-events'} + {/if}
{#if closeModal} diff --git a/frontend/src/lib/components/Forms/ModelForm/EbiosRmForm.svelte b/frontend/src/lib/components/Forms/ModelForm/EbiosRmForm.svelte new file mode 100644 index 000000000..20ba8c544 --- /dev/null +++ b/frontend/src/lib/components/Forms/ModelForm/EbiosRmForm.svelte @@ -0,0 +1,110 @@ + + +{#if context !== 'ebiosRmStudy'} + + +