From b6cf0f9f7a463716bd319a67b9367b11f5797c67 Mon Sep 17 00:00:00 2001 From: monsieurswag Date: Mon, 21 Oct 2024 18:01:26 +0200 Subject: [PATCH] Remove dead code --- backend/core/models.py | 11 ----------- backend/core/views.py | 2 +- backend/iam/models.py | 10 ---------- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/backend/core/models.py b/backend/core/models.py index f4eaa1a02..ad0f917d3 100644 --- a/backend/core/models.py +++ b/backend/core/models.py @@ -1248,17 +1248,6 @@ def get_size(self): else: return f"{size / 1024 / 1024:.1f} MB" - def duplicate_into_folder(self, folder: Folder) -> Self: - duplicated_evidence = Evidence( - folder=folder, - name=self.name, - description=self.description, - attachment=self.attachment, - link=self.link, - ) - duplicated_evidence.save() - return duplicated_evidence - class AppliedControl(NameDescriptionMixin, FolderMixin, PublishInRootFolderMixin): class Status(models.TextChoices): diff --git a/backend/core/views.py b/backend/core/views.py index ddc6aaf3d..d25ff6ddd 100644 --- a/backend/core/views.py +++ b/backend/core/views.py @@ -968,7 +968,7 @@ def duplicate(self, request, pk): effort=applied_control.effort, cost=applied_control.cost, ) - if request.data["duplicate_evidences"]: + if data["duplicate_evidences"]: duplicate_related_objects( applied_control, duplicate_applied_control, new_folder, "evidences" ) diff --git a/backend/iam/models.py b/backend/iam/models.py index be6d49e28..b95420807 100644 --- a/backend/iam/models.py +++ b/backend/iam/models.py @@ -116,16 +116,6 @@ def get_parent_folders(self) -> Generator[Self, None, None]: while (current_folder := current_folder.parent_folder) is not None: yield current_folder - # Is this function usefull ? - def can_access(self, folder: Self) -> bool: - return ( - self == folder - or any( - folder == parent_folder for parent_folder in self.get_parent_folders() - ) - or any(folder == sub_folder for sub_folder in self.get_sub_folders()) - ) - @staticmethod def _navigate_structure(start, path): """