From 08decdb908365450ffb08995abfeed17468195f0 Mon Sep 17 00:00:00 2001 From: Mohamed-Hacene Date: Fri, 29 Nov 2024 12:58:51 +0100 Subject: [PATCH] feat: keep order of security objectives --- backend/core/models.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/core/models.py b/backend/core/models.py index 474c5f4db..75000340e 100644 --- a/backend/core/models.py +++ b/backend/core/models.py @@ -1364,6 +1364,13 @@ def get_security_objectives(self) -> dict[str, dict[str, dict[str, int | bool]]] If the asset is a supporting asset, the security objectives are the union of the security objectives of all the primary assets it supports. If multiple ancestors share the same security objective, its value in the result is its highest value among the ancestors. """ + if self.security_objectives.get("objectives"): + self.security_objectives["objectives"] = { + key: self.security_objectives["objectives"][key] + for key in Asset.DEFAULT_SECURITY_OBJECTIVES + if key in self.security_objectives["objectives"] + } + if self.is_primary: return self.security_objectives